Commit graph

18192 commits

Author SHA1 Message Date
Gleb Shchepa
790edf009a backport from 6.0
Bug#35658 (An empty binary value leads to mysqld crash)
        
Before this fix, the following token
  b''
caused the parser to crash when reading the binary value from the empty string.
The crash was caused by:
  ptr+= max_length - 1;
because max_length is unsigned and was 0, causing an overflow.
        
With this fix, an empty binary literal b'' is parsed as a binary value 0,
in Item_bin_string.
2008-06-27 20:56:41 +05:00
Kristofer Pettersson
71be65dd11 Bug#30087 Set query_cache_size, if the value is too small, get a unclear warning
This bugs clarifies a warning message issued when the query cache data
size becomes smaller than the minium allowed size.
2008-06-19 02:40:35 +02:00
Kristofer Pettersson
ccd534c3ea Bug#21226 FLUSH PRIVILEGES does not provided feedback when it fails.
If during a FLUSH PRIVILEGES the server fails to load the new privilege
tables, the error message is lost. This patch is a back port from 5.1 which
adresses this issue by setting the server in an error state if a failure
occurrs.
  
This patch also corrects an incorrect variable assignment which might
cause an error state to be reverted by coincidence.
2008-06-18 21:09:30 +02:00
Georgi Kodinov
a8bdb4b3c5 atuomatically merged 5.0 main to 5.0-bugteam 2008-06-12 17:32:31 +03:00
Georgi Kodinov
9bc98e8df2 Bug#37069 (5.0): implement --skip-federated 2008-06-03 13:12:37 +03:00
Alexander Barkov
ca1860c36c Updating charset doc files.
Thanks to Paul for preparing the up-to-date files
reflecting 4.1 changes.
2008-05-28 15:03:47 +05:00
gshchepa/uchum@host.loc
80b16212c3 Merge host.loc:/work/bugs/5.0-bugteam-36676
into  host.loc:/work/bk/5.0-bugteam
2008-05-18 14:27:17 +05:00
gshchepa/uchum@host.loc
2459d3a9ad Fixed bug#36676: multiupdate using LEFT JOIN updates only
first row or fails with an error:
  ERROR 1022 (23000): Can't write; duplicate key in table ''

The server uses intermediate temporary table to store updated
row data.  The first column of this table contains rowid.
Current server implementation doesn't reset NULL flag of that
column even if the server fills a column with rowid.
To keep each rowid unique, there is an unique index.
An insertion into an unique index takes into account NULL
flag of key value and ignores real data if NULL flag is set.
So, insertion of actually different rowids may lead to two
kind of problems.  Visible effect of each of these problems
depends on an initial engine type of temporary table:

1. If multiupdate initially creates temporary table as
a MyISAM table (a table contains blob columns, and the
create_tmp_table function assumes, that this table is
large), it inserts only one single row and updates
only rows with one corresponding rowid. Other rows are
silently ignored. 

2. If multiupdate initially creates MEMORY temporary
table, fills it with data and reaches size limit for
MEMORY tables (max_heap_table_size), multiupdate
converts MEMORY table into MyISAM table and fails
with an error:
  ERROR 1022 (23000): Can't write; duplicate key in table ''


Multiupdate has been fixed to update the NULL flag of
temporary table rowid columns.
2008-05-18 14:21:25 +05:00
holyfoot/hf@mysql.com/hfmain.(none)
f9d183b5dc Bug #36705 key_buffer_size of >= 2G allocates all availabel virtual memory on 64-bit wondo.
temporary variables of 'long' types were used to store ulong values,
that causes init_key_cache to receive distorted parameters
2008-05-17 12:53:47 +05:00
cmiller@zippy.cornsilk.net
c1f35308cb Merge bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-bugteam
2008-05-16 17:48:07 -04:00
cmiller@zippy.cornsilk.net
34deab48db Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my50-bug36570
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-bugteam
2008-05-16 17:40:01 -04:00
gkodinov/kgeorge@magare.gmz
0b7abbecbe Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  magare.gmz:/home/kgeorge/mysql/autopush/B36011-take2-5.0-bugteam
2008-05-16 18:56:43 +03:00
gkodinov/kgeorge@magare.gmz
df3341a764 Bug #36011: server crash with explain extended on query
with dependent subqueries
An IN subquery is executed on EXPLAIN when it's not correlated.
If the subquery required a temporary table for its execution
not all the internal structures were restored from pointing to
the items of the temporary table to point back to the items of
the subquery.
Fixed by restoring the ref array when a temp tables were used in
executing the IN subquery during EXPLAIN EXTENDED.
2008-05-16 17:05:55 +03:00
gshchepa/uchum@host.loc
4dfd740683 Merge host.loc:/work/bugs/5.0-bugteam-36488
into  host.loc:/work/bk/5.0-bugteam
2008-05-16 13:00:12 +05:00
cmiller@zippy.cornsilk.net
573828aa6a Bug#36570: Parse error of CREATE PROCEDURE stmt with comments on \
slave

The stored-routine code took the contents of the (lowest) parser
and copied it directly to the binlog, which causes problems if there
is a special case of interpretation at the parser level -- which 
there is, in the "/*!VER */" comments.  The trailing "*/" caused
errors on the slave, naturally.

Now, since by that point we have /properly/ created parse-tree (as 
the rest of the server should do!) for the stored-routine CREATE, we
can construct a perfect statement from that information, instead of
writing uncertain information from an unknown parser state.  
Fortunately, there's already a function nearby that does exactly 
that.
---
Update for Bug#36570.  Qualify routine names with db name when
writing to the binlog ONLY if the source text is qualified.
2008-05-15 19:13:24 -04:00
gshchepa/uchum@host.loc
ba18c0bfd9 Fixed bug #36488: regexp returns false matches, concatenating
with previous rows.

The WHERE clause containing expression:
  CONCAT(empty_field1, empty_field2, ..., 'literal constant', ...)
    REGEXP 'regular expression'
may return wrong matches.

Optimization of the CONCAT function has been fixed.
2008-05-13 20:27:46 +05:00
gshchepa/uchum@host.loc
29a755fee1 Merge host.loc:/work/bugs/5.0-bugteam-30059
into  host.loc:/work/bk/5.0-bugteam
2008-05-13 16:59:44 +05:00
gshchepa/uchum@host.loc
486ef1bad6 Merge host.loc:/work/bugs/5.0-bugteam-36055
into  host.loc:/work/bk/5.0-bugteam
2008-05-13 00:32:43 +05:00
gshchepa/uchum@host.loc
1e7be565e2 Fixed bug #36055: mysql_upgrade doesn't really 'upgrade' tables
The REPAIR TABLE ... USE_FRM query silently corrupts data of tables
with old .FRM file version.
The mysql_upgrade client program or the REPAIR TABLE query (without
the USE_FRM clause) can't prevent this trouble, because in the
common case they don't upgrade .FRM file to compatible structure.

1. Evaluation of the REPAIR TABLE ... USE_FRM query has been
   modified to reject such tables with the message:
   "Failed repairing incompatible .FRM file".

2. REPAIR TABLE query (without USE_FRM clause) evaluation has been
   modified to upgrade .FRM files to current version.

3. CHECK TABLE ... FOR UPGRADE query evaluation has been modified
   to return error status when .FRM file has incompatible version.

4. mysql_upgrade and mysqlcheck client programs call CHECK TABLE
   FOR UPGRADE and REPAIR TABLE queries, so their behaviors have
   been changed too to upgrade .FRM files with incompatible
   version numbers.
2008-05-12 21:01:13 +05:00
mattiasj@client-10-129-10-147.upp.off.mysql.com
1eb8991a4e Merge client-10-129-10-147.upp.off.mysql.com:/Users/mattiasj/clones/bug32575-50-bugteam
into  client-10-129-10-147.upp.off.mysql.com:/Users/mattiasj/clones/topush-50-bugteam
2008-05-08 11:26:20 +02:00
mattiasj@client-10-129-10-147.upp.off.mysql.com
bef6c14315 Bug#32575 - Parse error of stmt with extended comments on slave side
Problem was that mysql_create_view did not remove all comments characters
when writing to binlog, resulting in parse error of stmt on slave side.

Solution was to use the recreated select clause
and add a generated CHECK OPTION clause if needed.
2008-05-08 09:41:22 +02:00
gshchepa/uchum@host.loc
1c45081b52 Partial rollback of fix for bug #30059: End-space truncation is inconsistent
or incorrect.

For better conformance with standard, truncation procedure of CHAR columns
has been changed to ignore truncation of trailing whitespace characters
(note has been removed).

Finally, for columns with non-binary charsets:

1. CHAR(N) columns silently ignore trailing whitespace truncation;
2. VARCHAR and TEXT columns issue Note about truncation.

BLOBs and other columns with BINARY charset are unaffected.
2008-05-06 21:43:46 +05:00
gkodinov/kgeorge@magare.gmz
51cdfd34fd Merge bk-internal:/home/bk/mysql-5.0
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam
2008-05-05 15:04:26 +03:00
gkodinov/kgeorge@magare.gmz
e22ef24263 Fix for bug #35298: GROUP_CONCAT with DISTINCT can crash the server
The bug is a regression introduced by the patch for bug32798.

The code in Item_func_group_concat::clear() relied on the 'distinct'
variable to check if 'unique_filter' was initialized. That, however,
is not always valid because Item_func_group_concat::setup() can do
shortcuts in some cases w/o initializing 'unique_filter'.

Fixed by checking the value of 'unique_filter' instead of 'distinct'
before dereferencing.
2008-05-01 13:49:26 +03:00
gkodinov/kgeorge@magare.gmz
771d861c99 Merge bk-internal:/home/bk/mysql-5.0
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam
2008-05-01 13:40:56 +03:00
evgen@moonbone.local
e9e6679381 Bug#36023: Incorrect handling of zero length caused an assertion to fail.
When a zero length is provided to the my_decimal_length_to_precision
function along with unsigned_flag set to false it returns a negative value.
For queries that employs temporary tables may cause failed assertion or
excessive memory consumption while temporary table creation.

Now the my_decimal_length_to_precision and the my_decimal_precision_to_length
functions take unsigned_flag into account only if the length/precision
argument is non-zero.
2008-04-25 00:39:37 +04:00
gshchepa/uchum@host.loc
a0c5b495cb Fixed bug#36005: server crashes inside NOT IN clause subquery with
impossible WHERE/HAVING clause
                 (subselect_single_select_engine::exec).

Allocation and initialization of joined table list t1, t2... of
subqueries like:

    NOT IN (SELECT ... FROM t1,t2,... WHERE 0)

is optimized out, however server tries to traverse this list.
2008-04-23 02:27:23 +05:00
sergefp@mysql.com
dc01e1d612 BUG#36139 "float, zerofill, crash with subquery"
- Make convert_zerofill_number_to_string() take into account that the 
  constant it is converting may evaluate to NULL.
2008-04-22 02:53:12 +04:00
cmiller@zippy.cornsilk.net
82d8a99c05 Fix mismerge. 2008-04-10 15:55:37 -04:00
cmiller@zippy.cornsilk.net
b506166a0c Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug15776/my50-bug15776
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
2008-04-09 12:27:51 -04:00
cmiller@zippy.cornsilk.net
3e2457b71a Follow-up to B-g#15776, test failures on 64-bit linux.
Make maximum blob size to be 2**32-1, regardless of word size.

Fix failure of timestamp with size of 2**31-1.  The method of
rounding up to the nearest even number would overflow.
2008-04-09 12:27:30 -04:00
cmiller@zippy.cornsilk.net
61a528c0b2 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug26294/my50-bug26294
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
2008-04-03 13:19:55 -04:00
cmiller@zippy.cornsilk.net
9ff7a0cedc Bug#26294: library name conflict between MySQL 4.x, 5.0 and Qt 3.3
When linking with some external programs, "multiple definition 
of `init_time'"

Rename init_time() to my_init_time() to avoid collision with other
libraries (particularly libmng).
2008-04-03 11:32:00 -04:00
cmiller@zippy.cornsilk.net
a296df9581 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
2008-04-03 11:28:10 -04:00
cmiller@zippy.cornsilk.net
844939eed6 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
2008-04-02 10:58:37 -04:00
cmiller@zippy.cornsilk.net
c83c18c058 Merge zippy.cornsilk.net:/home/cmiller/work/mysql/bug15776/my50-bug15776
into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.0-build
2008-04-02 10:56:49 -04:00
mkindahl@dl145h.mysql.com
fb9e8ed5e8 Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
2008-04-01 08:43:15 +02:00
mkindahl@dl145h.mysql.com
a7fe4abc55 Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
2008-03-31 09:57:29 +02:00
iggy@amd64.(none)
f13f6eaff3 Bug#26243 - Cleanup Valgrind error 2008-03-30 15:46:37 -04:00
gkodinov/kgeorge@macbook.gmz
fd9993db87 fixed warnings from the fix of 26243 2008-03-29 17:50:46 +02:00
gkodinov/kgeorge@macbook.gmz
84f761daaf fixes for warnings and compile errors for the fix of bug 26243 2008-03-29 16:12:23 +02:00
gkodinov/kgeorge@macbook.gmz
7cb4b7c19d fixed warnings and compile errors from the fix for bug 26243 2008-03-29 09:52:16 +02:00
iggy@amd64.(none)
b9877b84ac Merge amd64.(none):/src/mysql-5.0-bugteam
into  amd64.(none):/src/bug26243/my50-bug26243
2008-03-28 16:01:05 -04:00
anozdrin/alik@quad.opbmk
1e9e009e21 Merge bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-bt
2008-03-28 21:43:23 +03:00
iggy@amd64.(none)
79e434bc67 Bug#26243 mysql command line crash after control-c
- Backported the 5.1 DBUG to 5.0.
- Avoid memory cleanup race on Windows client for CTRL-C
2008-03-28 14:02:27 -04:00
anozdrin/alik@quad.opbmk
2880d2081e Fix for Bug#35469: server crash with LOAD DATA INFILE to a VIEW.
The problem was that LOAD DATA code (sql_load.cc) didn't take into
account that there may be items, representing references to other
columns. This is a usual case in views. The crash happened because
Item_direct_view_ref was casted to Item_user_var_as_out_param,
which is not a base class.

The fix is to
  1) Handle references properly;
  2) Ensure that an item is treated as a user variable only when
     it is a user variable indeed;
  3) Report an error if LOAD DATA is used to load data into
     non-updatable column.
2008-03-28 18:59:13 +03:00
mattiasj@witty.
6369418b1f Merge witty.:/Users/mattiasj/clones/bug21413-50-engines
into  witty.:/Users/mattiasj/clones/bug21413-50-bugteam
2008-03-28 15:17:36 +01:00
evgen@moonbone.local
0bce8e6f9b Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  moonbone.local:/work/27219-5.0-opt-mysql
2008-03-28 14:31:52 +03:00
gkodinov/kgeorge@magare.gmz
fb931bad54 Merge bk-internal:/home/bk/mysql-5.0
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam
2008-03-28 11:26:40 +02:00
gkodinov/kgeorge@magare.gmz
c95b11713c Merge bk-internal:/home/bk/mysql-5.0
into  magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam
2008-03-28 10:08:24 +02:00
evgen@moonbone.local
21c6145a6e Bug#27219: Aggregate functions in ORDER BY.
Mixing aggregate functions and non-grouping columns is not allowed in the
ONLY_FULL_GROUP_BY mode. However in some cases the error wasn't thrown because
of insufficient check.

In order to check more thoroughly the new algorithm employs a list of outer
fields used in a sum function and a SELECT_LEX::full_group_by_flag.
Each non-outer field checked to find out whether it's aggregated or not and
the current select is marked accordingly.
All outer fields that are used under an aggregate function are added to the
Item_sum::outer_fields list and later checked by the Item_sum::check_sum_func
function.
2008-03-27 19:49:32 +03:00
gshchepa/uchum@host.loc
931582bb58 Merge host.loc:/home/uchum/work/mysql-5.0
into  host.loc:/home/uchum/work/5.0-opt
2008-03-27 20:05:51 +04:00
mattiasj@witty.
16e83e55e6 Merge witty.:/Users/mattiasj/Public/shared-vms/bug21413-41-engines
into  witty.:/Users/mattiasj/clones/bug21413-50-engines
2008-03-27 16:24:11 +01:00
davi@endora.local
c0aff004b9 Merge mysql.com:/Users/davi/mysql/mysql-5.1-bug33201
into  mysql.com:/Users/davi/mysql/mysql-5.0-bugteam
2008-03-27 09:13:51 -03:00
gshchepa/uchum@host.loc
7edeebc9ab Merge host.loc:/home/uchum/work/mysql-5.0
into  host.loc:/home/uchum/work/5.0-opt
2008-03-27 15:52:55 +04:00
tnurnberg@white.intern.koehntopp.de
88204b5249 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-bugteam
into  mysql.com:/misc/mysql/34731/50-34731
2008-03-27 03:19:21 +01:00
tnurnberg@white.intern.koehntopp.de
e09d983825 Merge mysql.com:/misc/mysql/34731_/50-34731
into  mysql.com:/misc/mysql/34731/50-34731
2008-03-27 03:16:35 +01:00
mattiasj@witty.
c87874a1a3 Recommit of antonys previous commit.
Bug#21413
"Engine table handler used by multiple threads in REPLACE DELAYED"
When executing a REPLACE DELAYED statement, the storage engine
::extra() method was invoked by a different thread than the thread
which has acquired the handler instance.

This did not cause problems within the current server and with
the current storage engines.
But it has the potential to confuse future storage engines.

Added code to avoid surplus calls to extra() method in case of DELAYED
which avoids calling storage engine from a different thread than
expected.

No test case.
This change does not change behavior in conjunction with current
storage engines. So it cannot be tested by the regression test suite.
2008-03-27 01:13:39 +01:00
cmiller@zippy.cornsilk.net
07a3ae238a Fix minor complaints of Marc Alff, for patch against B-g#15776. 2008-03-26 14:52:10 -04:00
gshchepa/uchum@host.loc
2dcec449e0 Fixed bug #35193.
View definition as SELECT ... FROM DUAL WHERE ... has
valid syntax, but use of such view in SELECT or
SHOW CREATE VIEW syntax causes unexpected syntax error.

Server omits FROM DUAL clause when storing view body
string in a .frm file for further evaluation.
However, syntax of SELECT-witout-FROM query is more
restrictive than SELECT FROM DUAL syntax, and doesn't
allow the WHERE clause.

NOTE: this syntax difference is not documented.


View registration procedure has been modified to
preserve original structure of view's body.
2008-03-26 22:43:12 +04:00
istruewing@stella.local
830096fe16 Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-26 16:48:46 +01:00
hezx@mail.hezx.com
d0ebb657ee Merge mail.hezx.com:/media/sda3/work/mysql/bkroot/mysql-5.0-rpl
into  mail.hezx.com:/media/sda3/work/mysql/bkwork/b33029_5.0_to_5.1_fails_on_dup_key/5.0
2008-03-26 21:37:34 +08:00
istruewing@stella.local
c82b842ad8 Merge stella.local:/home2/mydev/mysql-5.0-ateam
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-26 09:34:37 +01:00
istruewing@stella.local
fde9b55d61 Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-26 09:33:55 +01:00
anozdrin/alik@quad.opbmk
c941b9f349 Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0
into  quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged
2008-03-25 14:53:23 +03:00
svoj@mysql.com/june.mysql.com
f064cd84d5 BUG#35509 - Federated leaks memory when connecting to
localhost/default port

When creating federated table that points to unspecified host or
localhost on unspecified port or port is 0, small memory leak occurs.

This happens because we make a copy of unix socket path, which is
never freed.

With this fix we do not make a copy of unix socket path, instead
share->socket points to MYSQL_UNIX_ADDR constant directly.

This fix is covered by a test case for BUG34788.

Affects 5.0 only.
2008-03-25 12:47:57 +04:00
mhansson/autopush@riffraff.(none)
13d3e8af83 Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  riffraff.(none):/data0/autopush/my50-bug34529
2008-03-24 16:19:50 +01:00
gkodinov/kgeorge@magare.gmz
dff2a4c3a3 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26461-5.0-opt
2008-03-21 17:26:18 +02:00
gkodinov/kgeorge@macbook.gmz
ff0aac178d Bug #26461: Intrinsic data type bool (1 byte) redefined to BOOL (4 bytes)
The bool data type was redefined to BOOL (4 bytes on windows).
Removed the #define and fixed some of the warnings that were uncovered
by this.
Note that the fix also disables 2 warnings :
4800 : 'type' : forcing value to bool 'true' or 'false' (performance warning)
4805: 'operation' : unsafe mix of type 'type' and type 'type' in operation

These warnings will be handled in a separate bug, as they are performance related or bogus.

Fixed to int the return type of functions that return more than 
2 distinct values.
2008-03-21 17:23:17 +02:00
aelkin/andrei@mysql1000.(none)
7469e5ed3e Merge mysql1000.(none):/home/andrei/MySQL/FIXES/5.0/bug35178_bh_ai
into  mysql1000.(none):/home/andrei/MySQL/MERGE/5.0-bug18199_35178
2008-03-21 16:11:07 +02:00
aelkin/andrei@mysql1000.(none)
033c1965f7 Merge mysql1000.(none):/home/andrei/MySQL/FIXES/5.0/bug18199-purge_no_warn
into  mysql1000.(none):/home/andrei/MySQL/MERGE/5.0-bug18199_35178
2008-03-21 16:10:15 +02:00
svoj@mysql.com/june.mysql.com
2b552aae50 BUG#34788 - malformed federated connection url is not handled
correctly - crashes server !

Creating federated table with connect string containing empty
(zero-length) host name and port is evaluated as 0 (port is
incorrect, omitted or 0) crashes server.

This happens because federated calls strcmp() with NULL pointer.

Fixed by avoiding strcmp() call if hostname is set to NULL.
2008-03-20 19:07:17 +04:00
istruewing@stella.local
0efc834e8a Merge stella.local:/home2/mydev/mysql-5.0-ateam
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-20 10:57:24 +01:00
gshchepa/uchum@host.loc
e57eaf0cef Merge host.loc:/home/uchum/work/PA/5.0-opt-34763
into  host.loc:/home/uchum/work/5.0-opt
2008-03-20 00:29:50 +04:00
aelkin/andrei@mysql1000.(none)
b581227f89 Bug #35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables
binlogging of insert into a autoincrement blackhole table ignored
an explicit set insert_id.

Fixed with refining of the blackhole's insert method to call
update_auto_increment() that prepares binlogging the insert query 
with the preceeding set insert_id.

Note, as the engine does not store any actual data one has to explicitly
provide to the server with the value of the autoincrement column via
set insert_id. Otherwise binlogging will happend with the default 
set insert_id=1.
2008-03-19 18:44:50 +02:00
mhansson/martin@riffraff.(none)
86db2a0cd5 Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY
When swapping out heap I_S tables to disk, this is done after plan refinement.
Thus, READ_RECORD::file will still point to the (deleted) heap handler at start
of execution. This causes segmentation fault if join buffering is used and the 
query is a star query where the result is found to be empty before accessing
some table. In this case that table has not been initialized (i.e. had its 
READ_RECORD re-initialized) before the cleanup routine tries to close the handler.
Fixed by updating READ_RECORD::file when changing handler.
2008-03-19 14:32:28 +01:00
kaa@kaamos.(none)
a7d92c9879 Merge kaamos.(none):/data/src/opt/bug34512/my50
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-03-19 16:30:56 +03:00
svoj@mysql.com/april.(none)
70ca2ae287 Make gcov happy. 2008-03-18 16:38:12 +04:00
anozdrin/alik@quad.opbmk
50c37672a7 Merge quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0
into  quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged
2008-03-18 13:53:51 +03:00
aelkin/andrei@mysql1000.(none)
18dab9d7d8 Bug #18199 PURGE BINARY LOGS fails silently with missing logs;
Bug #18453  Warning/error message if there is a mismatch between ...
 
There were three problems:
 
 1. the reported lack of warnings for the BEFORE syntax of PURGE;
 2. the similar lack of warnings for the TO syntax;
 3. incompatible behaviour between the two in that the latter blanked out
    regardlessly of presence or lack the actual file corresponding to
    an index record; the former version gave up at the first mismatch.

fixed with deploying the warning's generation and synronizing logics of 
purge_logs() and purge_logs_before_date().
my_stat() is called in either of two branches of purge_logs() (responsible
for the TO syntax of PURGE) similarly to how it has behaved in the BEFORE syntax.
If there is no actual binlog file, my_stat returns NULL and my_delete is
not invoked.
A critical error is reported to the user if a file from the index
could not be retrieved info about or deleted with a system error code
different than ENOENT.
2008-03-17 20:19:04 +02:00
davi@mysql.com/endora.local
44fe22e727 Post-merge fix for Bug 35103. 2008-03-17 11:16:37 -03:00
antony@pcg5ppc.xiphis.org
0b4da8a381 Merge acurtis@bk-internal.mysql.com:/home/bk/mysql-5.0-engines
into  pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/merge.20080307/mysql-5.0
2008-03-14 15:28:36 -07:00
davi@mysql.com/endora.local
f23e3fd04c Bug#35103 mysql_client_test::test_bug29948 causes sporadic failures
The problem was that the COM_STMT_SEND_LONG_DATA was sending a response
packet if the prepared statement wasn't found in the server (due to
reconnection). The commands COM_STMT_SEND_LONG_DATA and COM_STMT_CLOSE
should not send any packets, even error packets should not be sent since
they are not expected by the client API.

The solution is to clear generated during the execution of the aforementioned
commands and to skip resend of prepared statement commands. Another fix is
that if the connection breaks during the send of prepared statement command,
the command is not sent again since the prepared statement is no longer in the
server.
2008-03-14 17:40:12 -03:00
gshchepa/uchum@host.loc
cf90fb5571 Fixed bug #34763.
Queries like:

  SELECT ROW(1, 2) IN (SELECT t1.a, 2)
    FROM t1 GROUP BY t1.a

or 

  SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2)
    FROM t1 GROUP BY t1.a

lead to assertion failure in the
Item_in_subselect::row_value_transformer method in debugging
build, or to unexpected error message in release build:

  ERROR 1247 (42S22): Reference '<list ref>' not supported (forward
                      reference in item list)

Unexpected error message and assertion failure have been
eliminated.
2008-03-14 23:11:59 +04:00
antony@pcg5ppc.xiphis.org
98eccfbe10 Merge pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/mysql-5.0
into  pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/merge.20080307/mysql-5.0
2008-03-14 10:44:06 -07:00
istruewing@stella.local
21e2a00057 Merge stella.local:/home2/mydev/mysql-5.0-ateam
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-14 18:28:37 +01:00
mkindahl@dl145h.mysql.com
6a4c4b1850 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
2008-03-14 18:24:02 +01:00
svoj@mysql.com/june.mysql.com
1f0e9f5a5d BUG#28248 - mysqldump results with MERGE ... UNION=() cannot be executed
When there are no underlying tables specified for a merge table,
SHOW CREATE TABLE outputs a statement that cannot be executed. The
same is true for mysqldump (it generates dumps that cannot be
executed).

This happens because SQL parser does not accept empty UNION() clause.

This patch changes the following:
- it is now possible to execute CREATE/ALTER statement with
  empty UNION() clause.
- the same as above, but still worth noting: it is now possible to
  remove underlying tables mapping using ALTER TABLE ... UNION=().
- SHOW CREATE TABLE does not output UNION() clause if there are
  no underlying tables specified for a merge table. This makes
  mysqldump slightly smaller.
2008-03-14 19:38:22 +04:00
istruewing@stella.local
d0b86d23d7 Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-03-14 09:48:57 +01:00
hezx@mail.hezx.com
97ae23f473 BUG#33029 5.0 to 5.1 replication fails on dup key when inserting
using a trig in SP

For all 5.0 and up to 5.1.12 exclusive, when a stored routine or
trigger caused an INSERT into an AUTO_INCREMENT column, the
generated AUTO_INCREMENT value should not be written into the
binary log, which means if a statement does not generate
AUTO_INCREMENT value itself, there will be no Intvar event (SET
INSERT_ID) associated with it even if one of the stored routine
or trigger caused generation of such a value. And meanwhile, when
executing a stored routine or trigger, it would ignore the
INSERT_ID value even if there is a INSERT_ID value available set
by a SET INSERT_ID statement.

Starting from MySQL 5.1.12, the generated AUTO_INCREMENT value is
written into the binary log, and the value will be used if
available when executing the stored routine or trigger.

Prior fix of this bug in MySQL 5.0 and prior MySQL 5.1.12
(referenced as the buggy versions in the text below), when a
statement that generates AUTO_INCREMENT value by the top
statement was executed in the body of a SP, all statements in the
SP after this statement would be treated as if they had generated
AUTO_INCREMENT by the top statement.  When a statement that did
not generate AUTO_INCREMENT value by the top statement but by a
function/trigger called by it, an erroneous Intvar event would be
associated with the statement, this erroneous INSERT_ID value
wouldn't cause problem when replicating between masters and
slaves of 5.0.x or prior 5.1.12, because the erroneous INSERT_ID
value was not used when executing functions/triggers. But when
replicating from buggy versions to 5.1.12 or newer, which will
use the INSERT_ID value in functions/triggers, the erroneous
value will be used, which would cause duplicate entry error and
cause the slave to stop.

The patch for 5.0 fixed it not to generate the erroneous Intvar
event, another patch for 5.1 fixed it to ignore the SET INSERT_ID
value when executing functions/triggers if it is replicating from
a master of buggy versions.
2008-03-14 10:03:01 +08:00
istruewing@stella.local
d5390b2d56 Bug#33756 - query cache with concurrent_insert=0 appears broken
When concurrent inserts were disabled, statements after an INSERT
were not put into the query cache. This happened because we do not
save the current data file length at statement start when
concurrent inserts are disabled. But we checked the always zero
local length against the real file length anyway.
  
Fixed by doing the check only if concurrent inserts are not diabled.
2008-03-13 16:39:27 +01:00
anozdrin/alik@quad.
2b09a99340 A fix for Bug#34643: TRUNCATE crash if trigger and foreign key.
In cases when TRUNCATE was executed by invoking mysql_delete() rather
than by table recreation (for example, when TRUNCATE was issued on
InnoDB table with is referenced by foreign key) triggers were invoked.
In debug builds this also led to crash because of an assertion, which
assumes that some preliminary actions take place before trigger 
invocation, which doesn't happen in case of TRUNCATE.

The fix is not to execute triggers in mysql_delete() when this
function is used by TRUNCATE.
2008-03-12 16:13:33 +03:00
kaa@kaamos.(none)
d0eb90501d Merge kaamos.(none):/data/src/mysql-5.0
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-03-12 10:59:15 +03:00
sven@riska.(none)
1322371fb2 BUG#31024: STOP SLAVE does not stop attempted connect()s
Problem: if the IO slave thread is attempting to connect,
STOP SLAVE waits for the attempt to finish. 
It may take a long time.
Fix: don't wait, stop the slave immediately.
2008-03-11 14:42:54 +01:00
tnurnberg@mysql.com/white.intern.koehntopp.de
3db8534ed4 Bug#34731: highest possible value for INT erroneously filtered by WHERE
WHERE f1 < n ignored row if f1 was indexed integer column and
f1 = TYPE_MAX ^ n = TYPE_MAX+1. The latter value when treated
as TYPE overflowed (obviously). This was not handled, it is now.
2008-03-10 11:12:12 +01:00
tnurnberg@white.intern.koehntopp.de
3a87bbfe42 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/misc/mysql/34749/50-34749
2008-03-10 07:11:12 +01:00
kaa@kaamos.(none)
ace5022619 Merge kaamos.(none):/data/src/opt/bug34889/my50
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-03-08 14:20:55 +03:00
antony@pcg5ppc.xiphis.org
9c4e4640ad Merge pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/mysql-5.0-engines
into  pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/merge.20080307/mysql-5.0
2008-03-07 13:41:11 -08:00
svoj@june.mysql.com
cc5b8de811 Merge mysql.com:/home/svoj/devel/bk/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.0-engines
2008-03-07 21:19:30 +04:00
kaa@kaamos.(none)
4ca61aa36e Fix for bug #34512: CAST( AVG( double ) AS DECIMAL )
returns wrong results

Casting AVG() to DECIMAL led to incorrect results when the arguments
had a non-DECIMAL type, because in this case
Item_sum_avg::val_decimal() performed the division by the number of
arguments twice.

Fixed by changing Item_sum_avg::val_decimal() to not rely on
Item_sum_sum::val_decimal(), i.e. calculate sum and divide using
DECIMAL arithmetics for DECIMAL arguments, and utilize val_real() with
subsequent conversion to DECIMAL otherwise.
2008-03-06 18:19:47 +03:00
aelkin/andrei@mysql1000.(none)
122fefc593 Bug#26622 MASTER_POS_WAIT does not work as documented
MASTER_POS_WAIT return values are different than expected when the server is not a slave. 
It returns -1 instead of NULL.

Fixed with correcting  st_relay_log_info::wait_for_pos() to return the proper
value in the case of rli info is not inited.
2008-03-06 14:49:21 +02:00
bar@bar.myoffice.izhnet.ru
34da9303ef Merge mysql.com:/home/bar/mysql-work/mysql-5.0.b27580
into  mysql.com:/home/bar/mysql-work/mysql-5.0.b27580v2
2008-03-06 08:41:05 +04:00
kaa@kaamos.(none)
80d89023ea Fix for bug #34889: mysql_client_test::test_mysql_insert_id test fails
sporadically

Under some circumstances, the mysql_insert_id() value after SELECT ...
INSERT could return a wrong value. This could happen when the last
SELECT ... INSERT did not involve an AUTO_INCREMENT column, but the
value of mysql_insert_id() was changed by some previous statements.

Fixed by checking the value of thd->insert_id_used in
select_insert::send_eof() and returning 0 for mysql_insert_id() if it
is not set.
2008-03-05 16:02:33 +03:00
mkindahl@dl145h.mysql.com
57f6c4b362 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
2008-03-05 09:42:26 +01:00
sergefp@mysql.com
b779af5503 BUG#34945: "ref_or_null queries that are null_rejecting and have a null value crash mysql"
- Apply Eric Bergen's patch: in join_read_always_key(), move ha_index_init() call
  to before the late NULLs filtering code.
- Backport function comments from 6.0.
2008-03-03 20:35:44 +03:00
gshchepa/uchum@host.loc
00b942ebfd Merge host.loc:/home/uchum/work/5.0-opt-34830
into  host.loc:/home/uchum/work/5.0-opt
2008-03-01 12:24:55 +04:00
gluh@mysql.com/eagle.(none)
0596b1c6cd wrong merge fix 2008-02-29 17:50:01 +04:00
gshchepa/uchum@host.loc
3bf9c7edf1 Fixed bug #34830: mixed table and field names in Item_ref
and Item_direct_ref constructor calls.

Order of ref->field_name and ref->table_name arguments
is of Item_ref and Item_direct_ref in the fix_inner_refs
function is inverted.
2008-02-29 15:11:11 +04:00
gluh@mysql.com/eagle.(none)
931bdedbc2 after merge fix 2008-02-29 15:04:00 +04:00
gluh@eagle.(none)
df5fbf5ae0 Merge mysql.com:/home/gluh/MySQL/Merge/4.1-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2008-02-29 14:05:38 +04:00
gluh@mysql.com/eagle.(none)
13bb7e0a22 Bug#32167 another privilege bypass with DATA/INDEX DIRECORY(ver 4.1,5.0)
added new function test_if_data_home_dir() which checks that
path does not contain mysql data home directory.
Using of mysql data home directory in
DATA DIRECTORY & INDEX DIRECTORY is disallowed.
2008-02-29 13:55:00 +04:00
davi@mysql.com/endora.local
369c249370 Post-merge fix for Bug 33851. The initialization order of members
must match the order which they were declared in the class definition.
2008-02-28 20:22:11 -03:00
gshchepa/uchum@host.loc
11a27f1215 Merge host.loc:/home/uchum/work/PP/5.0-opt-34620
into  host.loc:/home/uchum/work/5.0-opt
2008-02-28 22:57:22 +04:00
gshchepa/uchum@host.loc
c51106740d Fixed bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*):
Assertion `0' failed

If ROW item is a part of an expression that also has
aggregate function calls (COUNT/SUM/AVG...), a
"splitting" with an Item::split_sum_func2 function
is applied to that ROW item.
Current implementation of Item::split_sum_func2
replaces this Item_row with a newly created
Item_aggregate_ref reference to it.
Then the row cache tries to work with the
Item_aggregate_ref object as with the Item_row object:
row cache calls row-emulation methods such as cols and
element_index. Item_aggregate_ref (like it's parent
Item_ref) inherits dummy implementations of those
methods from the hierarchy root Item, and call to
them leads to failed assertions and wrong data
output.

Row-emulation virtual functions (cols, element_index, addr,
check_cols, null_inside and bring_value) of Item_ref have
been overloaded to forward calls to an underlying item
reference.
2008-02-28 22:53:31 +04:00
davi@mysql.com/endora.local
361262c7c0 Bug#33851 Passing UNSIGNED param to EXECUTE returns ERROR 1210
The problem is that passing anything other than a integer to a limit
clause in a prepared statement would fail. This limitation was introduced
to avoid replication problems (e.g: replicating the statement with a
string argument would cause a parse failure in the slave).

The solution is to convert arguments to the limit clause to a integer
value and use this converted value when persisting the query to the log.
2008-02-28 11:34:08 -03:00
tnurnberg@mysql.com/white.intern.koehntopp.de
c6b4d7a7c4 Bug#34749: Server crash when using NAME_CONST() with an aggregate function
NAME_CONST('whatever', -1) * MAX(whatever) bombed since -1 was
not seen as constant, but as FUNCTION_UNARY_MINUS(constant)
while we are at the same time pretending it was a basic const
item. This confused the aggregate handlers in exciting ways.
We now make NAME_CONST() behave more consistently.
2008-02-28 14:23:22 +01:00
gkodinov/kgeorge@magare.gmz
0443189d89 Bug #34747: crash in debug assertion check after derived table
Was a double-free of the Unique member of Item_func_group_concat.
This was not causing a crash because the Unique is a descendent of
Sql_alloc.
Fixed to free the Unique only if it was allocated for the instance 
of Item_func_group_concat it was referenced from
2008-02-28 13:31:19 +02:00
svoj@june.mysql.com
44340d9388 Merge mysql.com:/home/svoj/devel/bk/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG13861/mysql-5.0-engines
2008-02-27 17:33:19 +04:00
mkindahl@dl145h.mysql.com
3f85bbe53d Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
2008-02-27 10:57:48 +01:00
holyfoot/hf@hfmain.(none)
bf848358e5 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/25097/my50-25097
2008-02-27 13:43:41 +04:00
holyfoot/hf@mysql.com/hfmain.(none)
140ca59538 Bug #25097 mysql_server_init fails silently if no errmsg.sys is present.
There was no way to return an error from the client library
if no MYSQL connections was established.
So here i added variables to store that king of errors and
made functions like mysql_error(NULL) to return these.
2008-02-27 12:42:43 +04:00
anozdrin/alik@quad.
c61667bca8 Merge quad.:/mnt/raid/alik/MySQL/devel/5.0
into  quad.:/mnt/raid/alik/MySQL/devel/5.0-rt-merged
2008-02-26 19:23:37 +03:00
kaa@kaamos.(none)
e3de6b7d38 Merge kaamos.(none):/data/src/opt/bug33834/my50-bug33834
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-02-26 16:10:31 +03:00
kaa@kaamos.(none)
5a4e12cb56 Fix for bug #33834: FRAC_SECOND: Applicability not clear in
documentation

While the manual mentions FRAC_SECOND only for the TIMESTAMPADD()
function, it was also possible to use FRAC_SECOND with DATE_ADD(),
DATE_SUB() and +/- INTERVAL.

Fixed the parser to match the manual, i.e. using FRAC_SECOND for 
anything other than TIMESTAMPADD()/TIMESTAMPDIFF() now produces a 
syntax error.

Additionally, the patch allows MICROSECOND to be used in TIMESTAMPADD/
TIMESTAMPDIFF and marks FRAC_SECOND as deprecated.
2008-02-25 13:25:57 +03:00
ramil/ram@ramil.myoffice.izhnet.ru
5edab018f9 Merge mysql.com:/home/ram/work/mysql-5.0-engines
into  mysql.com:/home/ram/work/b33304/b33304.5.0
2008-02-24 16:24:53 +04:00
kaa@kaamos.(none)
04a27a078f Merge kaamos.(none):/data/src/opt/bug33049/my50-bug33790
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-02-22 21:25:11 +03:00
joerg@trift2.
c93bb1bfb1 Merge trift2.:/MySQL/M50/mysql-5.0
into  trift2.:/MySQL/M50/push-5.0
2008-02-22 16:36:09 +01:00
svoj@mysql.com/june.mysql.com
fe3b1c8e25 BUG#13861 - START SLAVE UNTIL may stop 1 evnt too late if
log-slave-updates and circul repl

Slave SQL thread may execute one extra event when there are events
skipped by slave I/O thread (e.g. originated by the same server).
Whereas it was requested not to do so by the UNTIL condition.

This happens because we compare with the end position of previously
executed event. This is fine when there are no skipped by slave I/O
thread events, as end position of previous event equals to start
position of to be executed event. Otherwise this position equals to
start position of skipped event.

This is fixed by:
- reading the event to be executed before checking if the until condition
  is satisfied.
- comparing the start position of the event to be executed. Since we do
  not have the start position available, we compute it by subtracting
  event length from end position (which is available).
- if there are no events on the event queue at the slave sql starting
  time, that meet until condition, we stop immediately, as in this
  case we do not want to wait for next event.
2008-02-22 19:07:07 +04:00
gkodinov/kgeorge@magare.gmz
0e763988f1 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B30604-5.0-opt
2008-02-22 15:36:27 +02:00
kaa@kaamos.(none)
0a29b8b085 Fix for bug #33049: Assert while running test-as3ap test(mysql-bench
suite)

Under some circumstances a combination of aggregate functions and
GROUP BY in a SELECT query over a VIEW could lead to incorrect
calculation of the result type of the aggregate function. This in
turn could result in incorrect results, or assertion failures on debug
builds.

Fixed by changing the logic in Item_sum_hybrid::fix_fields() so that
the argument's item is dereferenced before calling its type() method.
2008-02-22 11:34:18 +03:00
gluh@mysql.com/mgluh.(none)
4f0873c04b Bug#23588 SHOW COLUMNS on a temporary table causes locking issues
skip lock_type update for temporary tables
2008-02-22 12:30:17 +04:00
davi@buzz.(none)
28cfe06a1e Post-merge fix to silence compiler warning. 2008-02-21 19:28:25 -02:00
davi@mysql.com/endora.local
0e91461842 Bug#32890 Crash after repeated create and drop of tables and views
The problem is that CREATE VIEW statements inside prepared statements
weren't being expanded during the prepare phase, which leads to objects
not being allocated in the appropriate memory arenas.

The solution is to perform the validation of CREATE VIEW statements
during the prepare phase of a prepared statement. The validation
during the prepare phase assures that transformations of the parsed
tree will use the permanent arena of the prepared statement.
2008-02-21 14:58:29 -03:00
anozdrin/alik@quad.
f5cb5fdc4f Fix for Bug#34337: Server crash when Altering a view using
a table name.
  
The problem was that fill_defined_view_parts() did not return
an error if a table is going to be altered. That happened if
the table was already in the table cache. In that case,
open_table() returned non-NULL value (valid TABLE-instance from
the cache).
  
The fix is to ensure that an error is thrown even if the table
is in the cache.

(This is a backport of the original patch for 5.1)
2008-02-21 12:17:32 +03:00
acurtis/antony@ltamd64.xiphis.org
9ed3da2c12 Merge xiphis.org:/anubis/antony/work/mysql-5.0-engines
into  xiphis.org:/anubis/antony/work/merge.20080220/mysql-5.0
2008-02-20 22:42:24 -08:00
vvaintroub@wva.
89aebb65fc Merge vvaintroub@bk-internal.mysql.com:/home/bk/mysql-5.0-build
into  wva.:C:/bk/bug31745_2/mysql-5.0-build
2008-02-21 02:22:02 +01:00
davi@mysql.com/endora.local
0473205592 Bug#32265 Server returns different metadata if prepared statement is used
Executing a prepared statement associated with a materialized
cursor yields to the client a metadata packet with wrong table
and database names. The problem was occurring because the server
was sending the the name of the temporary table used by the cursor
instead of the table name of the original table. The same problem
occurs when selecting from views, in which case the table name was
being sent and not the name of the view.
  
The solution is to fill the list item from the temporary table but
preserving the table and database names of the original fields. This
is achieved by tweaking the Select_materialize to accept a pointer to
the Materialized_cursor class which contains the item list to be filled.
2008-02-20 16:45:24 -03:00
mkindahl@dl145h.mysql.com
06375e2130 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
2008-02-20 19:25:18 +01:00
gkodinov/kgeorge@magare.gmz
5b508f2d16 Bug #30604: different flagging of time_zone_used in normal
and ps-protocol
Finding a routine should be a transparent operation as 
far as the binary log is concerned.
But it was influencing the binary log because of the TIMESTAMP
column in the proc table.

Fixed by preserving and restoring the time_zone usage flag when
searching for a stored routine in the proc table.
2008-02-19 17:27:18 +02:00
svoj@mysql.com/june.mysql.com
921e1cc4bb BUG#34289 - Incorrect NAME_CONST substitution in stored procedures
breaks replication

NAME_CONST() didn't replicate constant character set and collation
correctly.

With this fix NAME_CONST() inherits collation from the value argument.
2008-02-19 18:16:17 +04:00
vvaintroub@wva.
f5932c0d95 Bug#31745 - crash handler does not work on Windows
- Replace per-thread signal()'s with  SetUnhandledExceptionFilter(). 
  The only remaining signal() is for SIGABRT (default abort()
  handler in VS2005 is broken, i.e removes user exception filter)
- remove MessageBox()'es  from error handling code
- Windows port for print_stacktrace() and write_core() 
- Cleanup, removed some unused functions
2008-02-19 12:37:39 +01:00
holyfoot/hf@hfmain.(none)
652b7099ca Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/32942/my50-32942
2008-02-18 19:18:44 +04:00
kaa@kaamos.(none)
443c1a8b19 Merge ssh://bk-internal.mysql.com//home/bk/mysql-5.0-opt
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-02-17 16:57:07 +03:00
holyfoot/hf@mysql.com/hfmain.(none)
7abba3b021 Bug #32942 now() - interval '7200' second NOT pre-calculated, causing "full table scan"
Problem is not about intervals and doesn't actually cause 'full table scan'.
We have an optimization for DISTINCT when we have
'DISTINCT field_from_first_join_table' we don't need to read all the
rows from the JOIN-ed table if we found one conforming row.
It stopped working in 5.0 as we return NESTED_LOOP_OK if we came upon
that case in the evaluate_join_record() and that doesn't break the
recordreading loop in sub_select().

Fixed by returning NESTED_LOOP_NO_MORE_ROWS in this case.
2008-02-17 15:48:17 +04:00
kaa@kaamos.(none)
3daeb40f1f Merge kaamos.(none):/data/src/mysql-5.0
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-02-17 14:37:39 +03:00
istruewing@stella.local
b620694ba3 Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-02-15 20:06:15 +01:00
mkindahl@dl145h.mysql.com
d277f9344f Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
2008-02-15 17:51:35 +01:00
gkodinov/kgeorge@magare.gmz
a781c1b140 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B31887-5.0-opt
2008-02-15 18:34:03 +02:00
gkodinov/kgeorge@magare.gmz
490ec62be4 Bug #31887: DML Select statement not returning same results
when executed in version 5

Zero fill is a field attribute only. So we can't always 
propagate  constants for zerofill fields : the values and 
expression results don't have that flag.

Fixed by converting the const value to a string and 
using that in const propagation when the context allows it. 
Disable const propagation for fields with ZEROFILL flag in
all the other cases.
2008-02-15 15:47:32 +02:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
fe6d4aef3a Fix for bug #33304: Test 'func_group' hangs on Mac OS X 10.4 PowerPC 64-bit
Problem: SLEEP(0) never returns on 64-bit Mac OS X due to a bug in 
pthread_cond_timedwait().

Fix: when given a very short timeout just return immediately.
2008-02-15 16:03:54 +04:00
aelkin/andrei@mysql1000.dsl.inet.fi
416001d8ed Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  mysql1000.dsl.inet.fi:/home/andrei/MySQL/MERGE/5.0-bug33931-assert_write_ignored_ev_when_init_slave_fails
2008-02-14 21:38:30 +02:00
istruewing@stella.local
6c977025df Merge stella.local:/home2/mydev/mysql-5.0-ateam
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-02-14 20:24:01 +01:00
istruewing@stella.local
b6c8f8a58b Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-02-14 16:14:30 +01:00
aelkin/andrei@mysql1000.dsl.inet.fi
871eb3e5ad bug#33329 extraneous ROLLBACK in binlog on connection does not use trans tables
changes for an assert and an updated results file.
2008-02-14 16:28:32 +02:00
svoj@mysql.com/april.(none)
7fa875e42b BUG#33946 - Join on Federated tables with Unique index gives error 1430
from storage engine

Federated may crash a server, return wrong result set, return
"ERROR 1030 (HY000): Got error 1430 from storage engine" message
when local (engine=federated) table has a key against nullable
column.

The problem was wrong implementation of function that creates
WHERE clause for remote query from key.
2008-02-14 16:27:01 +04:00
aelkin/andrei@mysql1000.dsl.inet.fi
f5fe34dcd1 Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  mysql1000.dsl.inet.fi:/home/andrei/MySQL/MERGE/5.0-bug33931-assert_write_ignored_ev_when_init_slave_fails
2008-02-14 13:55:11 +02:00
kaa@kaamos.(none)
f41a5edfc7 Merge ssh://bk-internal.mysql.com//home/bk/mysql-5.0-opt
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-02-14 12:48:25 +03:00
gshchepa/uchum@host.loc
814314be6b Merge host.loc:/home/uchum/work/5.0-opt-gca
into  host.loc:/home/uchum/work/5.0-opt
2008-02-13 19:47:39 +04:00
gshchepa/uchum@host.loc
18770a0de8 Fixed bug#31194: Privilege ordering does not order properly
for wildcard values.
The server ignored escape character before wildcards during
the calculation of priority values for sorting of a privilege
list. (Actually the server counted an escape character as an
ordinary wildcard like % or _). I.e. the table name template
with a wildcard character like 'tbl_1' had higher priority in
a privilege list than concrete table name without wildcards
like 'tbl\_1', and some privileges of 'tbl\_1' was hidden
by privileges for 'tbl_1'.

The get_sort function has been modified to ignore escaped
wildcards as usual.
2008-02-13 19:34:12 +04:00
gshchepa/uchum@host.loc
8f6ecbca82 Fixed bug#33764: Wrong result with IN(), CONCAT() and implicit
type conversion.

Instead of copying of whole character string from a temporary
buffer, the server copied a short-living pointer to that string
into a long-living structure. That has been fixed.
2008-02-13 19:32:19 +04:00
aelkin/andrei@mysql1000.dsl.inet.fi
22072c5c57 Bug #33931 assertion at write_ignored_events_info_to_relay_log if init_slave_thread() fails
and
bug#33932  assertion at handle_slave_sql if init_slave_thread() fails

the asserts were caused by 
  bug33931: having thd deleted at time of executing err: code plus
            a missed initialization;
  bug33932: initialization of slave_is_running member was missed;

fixed with relocating mi members initialization and removing delete thd
It is safe to do as deletion happens later explicitly in the caller of
init_slave_thread().

Todo: at merging the test is better to be moved into suite/bugs for 5.x (when x>0).
2008-02-13 14:09:41 +02:00
joerg@trift2.
e31275c481 Merge trift2.:/MySQL/M50/mysql-5.0
into  trift2.:/MySQL/M50/push-5.0
2008-02-13 12:48:25 +01:00
kaa@kaamos.(none)
1a67148ccd Merge mbp:src/opt/bug33389/my50-bug25162
into  kaamos.(none):/data/src/opt/mysql-5.0-opt
2008-02-12 22:51:01 +03:00
evgen@moonbone.local
f264f92c97 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/work/31590-bug-5.0-opt-mysql
2008-02-12 21:58:41 +03:00
aelkin/andrei@mysql1000.dsl.inet.fi
0eba2cf0bf Merge mysql1000.dsl.inet.fi:/home/andrei/MySQL/FIXES/5.0/bug32790-assert_mdel_norm_tables
into  mysql1000.dsl.inet.fi:/home/andrei/MySQL/MERGE/pushed.mysql-5.0-rpl-bug33329-extra_rollback
2008-02-12 12:38:55 +02:00
tomas@poseidon.ndb.mysql.com
a4d8864b5e Merge poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-rpl-merge
into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
2008-02-12 11:22:07 +01:00
kaa@mbp.
97c105cc17 Fix for bug #33389: Selecting from a view into a table from within SP
or trigger crashes server

Under some circumstances a combination of VIEWs, subselects with outer
references and PS/SP/triggers could lead to use of uninitialized memory
and server crash as a result.

Fixed by changing the code in Item_field::fix_fields() so that in cases
when the field is a VIEW reference, we first check whether the field
is also an outer reference, and mark it appropriately before returning.
2008-02-12 12:43:55 +03:00
mkindahl@dl145h.mysql.com
23d670c33e Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
2008-02-11 18:09:17 +01:00
istruewing@stella.local
21534505d0 Merge stella.local:/home2/mydev/mysql-5.0-amain
into  stella.local:/home2/mydev/mysql-5.0-axmrg
2008-02-11 11:19:06 +01:00
aelkin/andrei@mysql1000.dsl.inet.fi
0cd061e98f Merge mysql1000.dsl.inet.fi:/home/andrei/MySQL/FIXES/5.0/bug33329-extra_rollback_when_innodb_in
into  mysql1000.dsl.inet.fi:/home/andrei/MySQL/MERGE/mysql-5.0-rpl-bug33329-extra_rollback
2008-02-11 11:26:02 +02:00
tnurnberg@blasphemy.intern.azundris.com
5e23ea7288 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  mysql.com:/home/tnurnberg/21567/50-21567
2008-02-10 16:54:41 +01:00
kostja@dipika.(none)
0e4b6ea058 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  dipika.(none):/opt/local/work/mysql-5.0-runtime
2008-02-08 18:51:07 +03:00
gshchepa/uchum@host.loc
919f86fbb6 Merge gshchepa@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  host.loc:/home/uchum/work/5.0-opt
2008-02-08 17:04:07 +04:00
gshchepa/uchum@host.loc
2e9f2b678c Fixed bug#15409: Columns with 64-element SET may not be updated with integers.
SET column storing procedure has been modified to be 64bit-clean.
2008-02-08 16:04:01 +04:00
davi@mysql.com/endora.local
24b9abf36d Bug#33798 prepared statements improperly handle large unsigned ints
The unsignedness of large integer user variables was not being
properly preserved when feeded to prepared statements. This was
happening because the unsigned flags wasn't being updated when
converting the user variable is converted to a parameter.

The solution is to copy the unsigned flag when converting the
user variable to a parameter and take the unsigned flag into
account when converting the integer to a string.
2008-02-08 08:55:55 -02:00
evgen@sunlight.local
a927bdbe3e Bug#31590: Wrong error message on sort buffer being too small.
The out of memory error was thrown when the sort buffer size were too small.
This led to a user confusion.

Now filesort throws the error message about sort buffer being too small.
2008-02-08 13:35:00 +03:00
sergefp@mysql.com
954a16c6d3 BUG#27732 "Possible memory leak with index_merge"
The bug was that handler::clone/handler::ha_open() call caused allocation of 
cloned_copy->ref on the handler->table->mem_root. The allocated memory could not 
be reclaimed until the table is flushed, so it was possible to exhaust memory by 
repeatedly running index_merge queries without doing table flushes.  

The fix:
- make handler::clone() allocate new_handler->ref on the passed mem_root 
- make handler::ha_open() not allocate this->ref if it has already been allocated
There is no testcase as it is not possible to check small leaks from testsuite.
2008-02-07 05:10:04 +03:00
gshchepa/uchum@host.loc
368a8bb442 Merge host.loc:/home/uchum/work/5.0-opt-34223
into  host.loc:/home/uchum/work/5.0-opt
2008-02-07 04:57:21 +04:00
gshchepa/uchum@host.loc
8adc63ad36 Fixed bug#34223: Failure on assignment to my_innodb_autoextend_increment
and my_innodb_commit_concurrency global variables.

Type of the my_innodb_autoextend_increment and the
my_innodb_commit_concurrency variables has been changed to
GET_ULONG.
2008-02-07 04:14:50 +04:00
gshchepa/uchum@host.loc
8715855aa0 Fixed bug#30059.
Server handles truncation for assignment of too-long values
into CHAR/VARCHAR/TEXT columns in a different ways when the
truncated characters are spaces:
1. CHAR(N) columns silently ignore end-space truncation;
2. TEXT columns post a truncation warning/error in the
   non-strict/strict mode.
3. VARCHAR columns always post a truncation note in
   any mode.

Space truncation processing has been synchronised over
CHAR/VARCHAR/TEXT columns: current behavior of VARCHAR
columns has been propagated as standard.

Binary-encoded string/BLOB columns are not affected.
2008-02-07 02:33:21 +04:00
tomas@whalegate.ndb.mysql.com
1fa870fa88 Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
2008-02-06 11:42:18 +01:00
tsmith@ramayana.hindu.god
6726c9e32d Merge ramayana.hindu.god:/home/tsmith/m/bk/50
into  ramayana.hindu.god:/home/tsmith/m/bk/build/50
2008-02-05 16:04:07 -07:00
aelkin/elkin@koti.dsl.inet.fi
51b33ea35d Bug #34305 show slave status handling segfaults when slave io is about
to leave

The artifact was caused by
a flaw in concurrent accessing the slave's io thd by
the io itself and a handling show slave status thread.
Namely, show_master_info did not acquire mi->run_lock mutex that is
specified for mi->io_thd member.

Fixed with deploying the mutex locking and unlocking. The mutex is kept
short time and without interleaving with mi->data_lock mutex.

Todo: to report and fix an issue with 
    sys_var_slave_skip_counter::{methods} 
seem to acquire incorrectly
     active_mi->rli.run_lock
instead of the specified
     active_mi->rli.data_lock

A test case is difficult to compose, so rpl_packet should continue serving
as the indicator.
2008-02-05 17:36:26 +02:00
tnurnberg@blasphemy.intern.azundris.com
9928dac5f3 Bug#21567: mysqld doesn't react to Ctrl-C when run under GDB even with the --gdb option
Don't block SIGINT (Control-C) when --gdb is passed to mysqld.
Was broken at least on OS X.

(kudos to Mattias Jonsson)
2008-02-05 12:56:49 +01:00
aelkin/elkin@koti.dsl.inet.fi
7880fade24 Bug#33329 extraneous ROLLBACK in binlog on connection
does not use trans tables

There had been two issues.
Rollback statement was recorded in binlog even though a multi-update
had not modified any non-transactional table.
The reason for this artifact was a false initial value of multi_update::transactional_tables.
Yet another artifact that explained on the bug page is that 
`ha_autocommit_or_rollback' works differently depending on whether
a transaction engine has been compiled in. 

Fixed: with setting multi_update::transactional_tables to zero at initialization
time. Multi-update on non-trans table won't cause ROLLBACK in binlog with
either compilation option.

The 2nd mentioned artifact comprises a self-standing issue (to be reported
separately).
2008-02-04 16:37:41 +02:00
aelkin/elkin@koti.dsl.inet.fi
991b48200e Bug #32790 crash in trigger.test with InnoDB for a table
the reason for the failure were incorrect asserts.

Removing asserts altogether as there is no the implication does not hold
(as explained in the comments for the file).
2008-02-04 16:35:41 +02:00
thek@adventure.(none)
323e9a4c53 Bug#33201 Crash occurs when granting update privilege on one column of a view
When issuing a column level grant on a table which require pre-locking the 
server crashed.

The reason behind the crash was that data structures used by the lock api
wasn't properly reinitialized in the case of a column level grant.
2008-02-01 14:10:46 +01:00
kaa@mbp.local
e80794b3ee Merge mbp.local:/Users/kaa/src/opt/bug25162/my50-bug25162
into  mbp.local:/Users/kaa/src/opt/mysql-5.0-opt
2008-02-01 13:37:22 +05:00
kaa@mbp.local
663453d572 Fix for bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs
on table creates

The problem was in incompatible syntax for key definition in CREATE
TABLE.

5.0 supports only the following syntax for key definition (see "CREATE
TABLE syntax" in the manual):

{INDEX|KEY} [index_name] [index_type] (index_col_name,...)

While 5.1 parser supports the above syntax, the "preferred" syntax was
changed to:

{INDEX|KEY} [index_name] (index_col_name,...) [index_type]

The above syntax is used in 5.1 for the SHOW CREATE TABLE output, which
led to dumps generated by 5.1 being incompatible with 5.0.

Fixed by changing the parser in 5.0 to support both 5.0 and 5.1 syntax
for key definition.
2008-02-01 13:00:40 +05:00
evgen@moonbone.local
f967e24718 Bug#30787: Stored function ignores user defined alias.
Simple subselects are pulled into upper selects. This operation substitutes the
pulled subselect for the first item from the select list of the subselect.
If an alias is defined for a subselect it is inherited by the replacement item.
As this is done after fix_fields phase this alias isn't showed if the
replacement item is a stored function. This happens because the Item_func_sp::make_field
function makes send field from its result_field and ignores the defined alias.

Now when an alias is defined the Item_func_sp::make_field function sets it for
the returned field.
2008-01-31 23:46:26 +03:00
mkindahl@dl145h.mysql.com
7cfdd60045 Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
2008-01-31 16:15:46 +01:00
svoj@mysql.com/april.(none)
3b5c25ba65 BUG#22989 - START SLAVE causes Error on COM_REGISTER_SLAVE: 1105
'Wrong parameters to functi

START SLAVE reports vague error when it fails to register on master:
"Wrong parameters to function register_slave".

If master failed to register slave because of too long
'report-host'/'report-user'/'report-password', return better error
messages:
"Failed to register slave: too long 'report-host'"
"Failed to register slave: too long 'report-user'"
"Failed to register slave; too long 'report-password'"

No test case for this fix.
2008-01-31 18:51:20 +04:00
mkindahl@dl145h.mysql.com
b8428d1560 Fixes to make code compile on Windows. 2008-01-31 07:19:29 +01:00
tsmith@ramayana.hindu.god
c74959c9e0 Bug #32149 Long semaphore wait for adaptive hash latch
Fix by calling ha_release_temporary_latches() before ::filesort().
2008-01-30 19:00:20 -07:00
tomas@whalegate.ndb.mysql.com
4c77586d5c Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.0
into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.0-ndb-merge
2008-01-30 15:36:46 +01:00
mkindahl@dl145h.mysql.com
716c63ebaa Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl
into  dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
2008-01-30 11:25:54 +01:00
hezx@mail.hezx.com
afe8ac3128 Merge zhe@bk-internal.mysql.com:/home/bk/mysql-5.0-rpl
into  mail.hezx.com:/media/sda3/work/mysql/bkwork/bug26489_corruption_in_relay_log/5.0
2008-01-30 16:40:36 +08:00
hezx@mail.hezx.com
e4f37eab56 BUG#26489 Corruption in relay logs
Here is the scenario that causes the failure.(by Mats)

1. The to-be corrupt log event (let's call it X), is split into two
   packets B and C on the network level (net_write_buff()). The parts
   are X = (x',x''). The part x' ends up in packet B and part x''
   ends up in packet C. Prior to the corrupt event X, the event Y has
   been written successfully, but has been split into two packets as
   well, which we call (y',y'').
2. The master sends packet A = (y'',x') to the slave, increases the
   packet sequence number, the slave receives the packet, but fails
   to reply before the master gets a timeout.
3. Since the master got a timeout, it reports failure, and aborts
   sending the binary log by exiting mysql_binlog_send(). However, it
   leaves the buffer intact, still holding y'' (but not x', since the
   write_pos is not increased).
4. After exiting mysql_binlog_send(), the master does a
   disconnection of the client thread, which involves sending an
   error message e to the client (i.e., the slave).
5. In this case, net_write_buff() is used again, but this time the
   old contents of the packet is used so that the new packet is
   D = (y'',e). Note that this will use a new packet sequence number,
   since the packet number was increased in step 2.
6. The slave receives the tail y'' of the Y log event, concatenates
   this with x' (which it already received), and writes the event
   (x',y'') it to the relay log since it hasn't noticed anything is
   amiss.
7. It then tries to read more bytes, which is either e (if the length
   given for X just happened to match the length given for Y, or just
   plain garbage because the slave is out of sync with what is
   actually sent.
8. After a while, the SQL thread tries to execute the event (x',y''),
   which is very likely to be just nonsense.

The problem can be fixed by not resetting net->error after the call of 
mysql_binlog_send, so the error message will not be sent and the connection
will be closed.
2008-01-29 11:56:48 +08:00
joerg@trift2.
a6f257361e Merge trift2.:/MySQL/M50/mysql-5.0
into  trift2.:/MySQL/M50/push-5.0
2008-01-28 15:05:33 +01:00
igor@olga.mysql.com
5e14047e23 Fixed bug #33833.
Two disjuncts containing equalities of the form key=const1 and key=const2 can
be merged into one if const1 is equal to const2. To check it the common 
collation of the constants were used rather than the collation of the field key.
For example when the default collation of the constants was cases insensitive
while the collation of the field was case sensitive, then two or-ed equality 
predicates key='b' and key='B' incorrectly were merged into one f='b'. As a 
result ref access was used instead of range access and wrong result sets were 
returned in many cases. 
Fixed the problem by comparing constant in the or-ed predicate with collation of
the key field.
2008-01-26 21:45:35 -08:00