Commit graph

26116 commits

Author SHA1 Message Date
Martin Hansson
0c82d3f3f4 Merge of fix for Bug#52357 2010-05-06 10:59:28 +02:00
Martin Hansson
1eada91053 Bug#52357: Assertion failed: join->best_read in
greedy_search optimizer_search_depth=0

The algorithm inside restore_prev_nj_state failed to
properly update the counters within the NESTED_JOIN
tree. The counter was decremented each time a table in the
node was removed from the QEP, the correct thing to do being
only to decrement it when the last table in the child node
was removed from the plan. This lead to node counters
getting negative values and the plan thus appeared
impossible. An assertion caught this.

Fixed by not recursing up the tree unless the last table in
the join nest node is removed from the plan
2010-05-06 10:45:00 +02:00
Georgi Kodinov
addd0a3e67 On behalf of Kristofer :
Bug#53417 my_getwd() makes assumptions on the buffer sizes which not always hold true
      
The mysys library contains many functions for rewriting file paths. Most of these
functions makes implicit assumptions on the buffer sizes they write to. If a path is put
in my_realpath() it will propagate to my_getwd() which assumes that the buffer holding
the path name is greater than 2. This is not true in cases.
      
In the special case where a VARBIN_ITEM is passed as argument to the LOAD_FILE function
this can lead to a crash.
      
This patch fixes the issue by introduce more safe guards agaist buffer overruns.
2010-05-05 11:54:52 +03:00
Alfranio Correia
ed4819bbf7 merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam 2010-05-04 23:15:10 +01:00
Georgi Kodinov
71b453fa06 Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants.
This is the 5.1 merge and extension of the fix.
The server was happily accepting paths in table name in all places a table
name is accepted (e.g. a SELECT). This allowed all users that have some 
privilege over some database to read all tables in all databases in all
mysql server instances that the server file system has access to.
Fixed by :
1. making sure no path elements are allowed in quoted table name when
constructing the path (note that the path symbols are still valid in table names
when they're properly escaped by the server).
2. checking the #mysql50# prefixed names the same way they're checked for
path elements in mysql-5.0.
2010-05-04 17:03:28 +03:00
Alfranio Correia
3c30921662 BUG#43407 SET GLOBAL SQL_SLAVE_SKIP_COUNTER should log previous state in error log
When issuing a 'SET GLOBAL SQL_SLAVE_SKIP_COUNTER' statement, the previous
position along with the new position is dumped into the error log. Namely,
the following information is printed out: skip_counter, group_relay_log_name
and group_relay_log_pos.
2010-05-04 10:41:28 +01:00
Alfranio Correia
819caf8eb8 BUG#43406 CHANGE MASTER TO should log previous state in error log
When issuing a 'CHANGE MASTER TO' statement, key elements of the previous
state, namely the host, port, the master_log_file and the master_log_pos
are dumped into the error log.
2010-05-04 10:17:20 +01:00
Kristofer Pettersson
5dd5d70506 Bug#50373 --secure-file-priv=""
Iterative patch improvement. Previously committed patch
caused wrong result on Windows. The previous patch also
broke secure_file_priv for symlinks since not all file
paths which must be compared against this variable are
normalized using the same norm.

The server variable opt_secure_file_priv wasn't
normalized properly and caused the operations
LOAD DATA INFILE .. INTO TABLE ..
and
SELECT load_file(..)
to do different interpretations of the 
--secure-file-priv option.
     
The patch moves code to the server initialization
routines so that the path always is normalized
once and only once.
      
It was also intended that setting the option
to an empty string should be equal to 
lifting all previously set restrictions. This
is also fixed by this patch.


mysql-test/r/loaddata.result:
  * Removed test code which will currently break the much used --mem feature of mtr.
mysql-test/t/loaddata.test:
  * Removed test code which will currently break the much used --mem feature of mtr.
sql/item_strfunc.cc:
  * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
sql/mysql_priv.h:
  * Added signature for is_secure_file_path()
sql/mysqld.cc:
  * New function for checking if a path compatible with the secure path restriction.
  * Added initialization of the opt_secure_file_priv variable.
sql/sql_class.cc:
  * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
sql/sql_load.cc:
  * Replaced string comparing code on opt_secure_file_priv with an interface which guarantees that both file paths are normalized using the same norm on all platforms.
2010-05-03 18:14:39 +02:00
Georgi Kodinov
f63608ea97 Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants.
The server was not checking the supplied to COM_FIELD_LIST table name
for validity and compliance to acceptable table names standards.
Fixed by checking the table name for compliance similar to how it's 
normally checked by the parser and returning an error message if 
it's not compliant.
2010-05-03 18:16:51 +03:00
Alexey Kopytov
26570994b2 Automerge. 2010-04-30 15:27:17 +04:00
Alexey Kopytov
97374a1184 Bug #48419: another explain crash..
WHERE predicates containing references to empty tables in a
subquery were handled incorrectly by the optimizer when
executing EXPLAIN. As a result, the optimizer could try to
evaluate such predicates rather than just stop with
"Impossible WHERE noticed after reading const tables" as 
it would do in a non-subquery case. This led to valgrind 
errors and crashes.

Fixed the code checking the above condition so that subqueries
are not excluded and hence are handled in the same way as top
level SELECTs.

mysql-test/r/explain.result:
  Added a test case for bug #48419.
mysql-test/r/ps.result:
  Updated test results to take the new (and more correct)
  "Extra" comments in execution plans.
mysql-test/t/explain.test:
  Added a test case for bug #48419.
sql/sql_select.cc:
  There is no point in excluding subqueries from checking
  for identically false WHERE conditions.
2010-04-30 15:10:48 +04:00
Davi Arnaut
4e378bc55b Manual merge. 2010-04-29 20:18:19 -03:00
Davi Arnaut
54705ab176 Bug#50974: Server keeps receiving big (> max_allowed_packet) packets indefinitely.
The server could be tricked to read packets indefinitely if it
received a packet larger than the maximum size of one packet.
This problem is aggravated by the fact that it can be triggered
before authentication.

The solution is to no skip big packets for non-authenticated
sessions. If a big packet is sent before a session is authen-
ticated, a error is returned and the connection is closed.

include/mysql_com.h:
  Add skip flag. Only used in server builds.
sql/net_serv.cc:
  Control whether big packets can be skipped.
2010-04-29 10:28:16 -03:00
Ramil Kalimullin
0d5dbb166b Fix for bug #53237: mysql_list_fields/COM_FIELD_LIST stack smashing
Problem: "COM_FIELD_LIST is an old command of the MySQL server, before there was real move to only
SQL. Seems that the data sent to COM_FIELD_LIST( mysql_list_fields() function) is not
checked for sanity. By sending long data for the table a buffer is overflown, which can
be used deliberately to include code that harms".

Fix: check incoming data length.


sql/sql_parse.cc:
  Fix for bug #53237: mysql_list_fields/COM_FIELD_LIST stack smashing
    - check incoming mysql_list_fields() table name arg length.
2010-04-29 08:42:32 +04:00
Alexey Kopytov
6d43510a42 Backport of the fix for bug #50335 to 5.0.
The problem was in an incorrect debug assertion. The expression
used in the failing assertion states that when finding
references matching ORDER BY expressions, there can be only one
reference to a single table. But that does not make any sense,
all test cases for this bug are valid examples with multiple
identical WHERE expressions referencing the same table which
are also present in the ORDER BY list.

Fixed by removing the failing assertion. We also have to take
care of the 'found' counter so that we count multiple
references only once. We rely on this fact later in
eq_ref_table().

mysql-test/r/join.result:
  Added a test case for bug #50335.
mysql-test/t/join.test:
  Added a test case for bug #50335.
sql/sql_select.cc:
  Removing the assertion in eq_ref_table() as it does not make
  any sense. We also have to take care of the 'found' counter so
  that we count multiple references only once. We rely on this
  fact later in eq_ref_table().
2010-04-27 00:06:00 +04:00
Davi Arnaut
7ecad98c45 Bug#50755: Crash if stored routine def contains version comments
The problem was that a syntactically invalid trigger could cause
the server to crash when trying to list triggers. The crash would
happen due to a mishap in the backup/restore procedure that should
protect parser items which are not associated with the trigger. The
backup/restore is used to isolate the parse tree (and context) of
a statement from the load (and parsing) of a trigger. In this case,
a error during the parsing of a trigger could cause the improper
backup/restore sequence.

The solution is to properly restore the original statement context
before the parser is exited due to syntax errors in the trigger body.

mysql-test/r/trigger.result:
  Add test case result for Bug#50755
mysql-test/t/trigger.test:
  Add test case for Bug#50755
sql/sp_head.cc:
  Merge sp_head::destroy() and sp_head destructor. Retrieve THD
  from the LEX so that m_thd is not necessary.
sql/sql_lex.cc:
  Explicitly restore the original environment.
2010-04-01 10:15:22 -03:00
Ramil Kalimullin
2303a8c6e4 Manual merge. 2010-04-29 08:54:09 +04:00
Georgi Kodinov
4d0e9957ac Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when JOINed
during an UPDATE

Extended the fix for bug 29310 to multi-table update:

When a table is being updated it has two set of fields - fields required for
checks of conditions and fields to be updated. A storage engine is allowed
not to retrieve columns marked for update. Due to this fact records can't
be compared to see whether the data has been changed or not. This makes the
server always update records independently of data change.
  
Now when an auto-updatable timestamp field is present and server sees that
a table handle isn't going to retrieve write-only fields then all of such
fields are marked as to be read to force the handler to retrieve them.
2010-04-28 15:55:54 +03:00
Vladislav Vaintroub
f72dcc9be8 Bug #48042 The description for Event ID ( 100 ) in Source ( MySQL ) cannot be found.
The problem is that message resource  (message.rc) is compiled as part of static library
sql.lib rather than with executable mysqld.exe. resource files do not work in static
libraries.

The fix is to add message.rc to mysqld.exe source files list.
2010-04-26 23:59:50 +02:00
Ramil Kalimullin
6595861f58 Fix for bug#50946: fast index creation still seems to copy the table
Problem: ALTER TABLE ADD INDEX may lead to table copying if there's
numeric field(s) with non-default display width modificator specified.

Fix: compare numeric field's storage lenghts when we decide whether 
they can be considered 'equal' for table alteration purposes.


mysql-test/r/error_simulation.result:
  Fix for bug#50946: fast index creation still seems to copy the table
    - test result.
mysql-test/t/error_simulation.test:
  Fix for bug#50946: fast index creation still seems to copy the table
    - test case.
sql/field.cc:
  Fix for bug#50946: fast index creation still seems to copy the table
    - check numeric field's pack lengths instead of it's display lenghts
  comparing fields equality for table alteration purposes.
sql/sql_table.cc:
  Fix for bug#50946: fast index creation still seems to copy the table
    - check compare_tables() result for testing purposes.
2010-04-25 15:06:40 +04:00
Staale Smedseng
20c9177518 Bug#46261 Plugins can be installed with --skip-grant-tables
Previously installed dynamic plugins are explicitly not loaded
on startup with --skip-grant-tables enabled. However, INSTALL
PLUGIN/UNINSTALL PLUGIN commands are allowed, and result in
inconsistent error messages (reporting duplicate plugin or
plugin does not exist).

This patch adds a check for --skip-grant-tables mode, and
returns error ER_OPTION_PREVENTS_STATEMENT to the user when
the above commands are attempted.
2010-04-22 15:52:00 +02:00
Kristofer Pettersson
4859951a90 automerge 2010-04-20 20:19:20 +02:00
Kristofer Pettersson
3a626d1027 Bug#50373 --secure-file-priv=""
Correcting a patch misstake. The converted file path is placed in 'buff' not in opt_secure_file_priv.

mysql-test/r/loaddata.result:
  * Updated test case; Since secure_file_priv now is normalized the previous values are changed.
sql/mysqld.cc:
  * Fixed patch misstake
2010-04-20 16:17:34 +02:00
Staale Smedseng
8b16a2a55b Bug#51591 deadlock in the plugins+status+variables
Unlocking/locking of LOCK_plugin in ha_ndbcluster.cc not 
needed anymore (but missing from the initial patch).
2010-04-19 15:48:37 +02:00
Kristofer Pettersson
95da93d7ac Automerge 2010-04-16 16:56:16 +02:00
Kristofer Pettersson
794a441317 Bug#50373 --secure-file-priv=""
The server variable opt_secure_file_priv wasn't
normalized properly and caused the operations
LOAD DATA INFILE .. INTO TABLE ..
and
SELECT load_file(..)
to do different interpretations of the 
--secure-file-priv option.

The patch moves code to the server initialization
routines so that the path always is normalized
once and only once.

It was also intended that setting the option
to an empty string should be equal to 
lifting all previously set restrictions. This
is also fixed by this patch.


sql/mysqld.cc:
  * If --secure_file_option is an empty string then the option variable
    should be unset.
  * opt_secure_file_option should be normalized once when the server starts.
sql/sql_load.cc:
  * moved variable normalization code to fix_paths()
2010-04-16 16:10:47 +02:00
Staale Smedseng
9743819d36 Bug#51591 deadlock in the plugins+status+variables
Potential deadlock situation involving LOCK_plugin,
LOCK_global_system_variables and LOCK_status.
      
This patch backports the fix from next-mr, unlocking
LOCK_plugin before calling plugin->init() and
add_status_vars().
2010-04-16 15:02:23 +02:00
Sergey Glukhov
649deaa8a1 Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
Arg_comparator initializes 'comparators' array in case of
ROW comparison and does not free this array on destruction.
It leads to memory leaks.
The fix:
-added Arg_comparator::cleanup() method which frees
 'comparators' array.
-added Item_bool_func2::cleanup() method which calls 
 Arg_comparator::cleanup() method


mysql-test/r/ps.result:
  test case
mysql-test/r/row.result:
  test case
mysql-test/t/ps.test:
  test case
mysql-test/t/row.test:
  test case
sql/item_cmpfunc.h:
  -added Arg_comparator::cleanup() method which frees
   'comparators' array.
  -added Item_bool_func2::cleanup() method which calls 
   Arg_comparator::cleanup() method
2010-04-16 16:42:34 +05:00
Luis Soares
8fa9a5861b automerge: merged bug clone into latest mysql-5.1-bugteam. 2010-04-16 01:59:21 +01:00
Sergey Vojtovich
c37bfe0ae6 Merge fix for BUG39053 to 5.1-bugteam. 2010-04-14 15:53:43 +04:00
Sergey Vojtovich
4aa36ee7b6 BUG#39053 - UNISTALL PLUGIN does not allow the storage engine
to cleanup open connections

It was possible to UNINSTALL storage engine plugin when binding
between THD object and storage engine is still active (e.g. in
the middle of transaction).

To avoid unclean deactivation (uninstall) of storage engine plugin
in the middle of transaction, additional storage engine plugin
lock is acquired by thd_set_ha_data().

If ha_data is not null and storage engine plugin was not locked
by thd_set_ha_data() in this connection before, storage engine
plugin gets locked.

If ha_data is null and storage engine plugin was locked by
thd_set_ha_data() in this connection before, storage engine
plugin lock gets released.

If handlerton::close_connection() didn't reset ha_data, server does
it immediately after calling handlerton::close_connection().

Note that this is just a framework fix, storage engines must switch
to thd_set_ha_data() from thd_ha_data() if they want to see fit.

include/mysql/plugin.h:
  As thd_{get|set}_ha_data() have some extra logic now, they
  must be implemented on server side.
include/mysql/plugin.h.pp:
  As thd_{get|set}_ha_data() have some extra logic now, they
  must be implemented on server side.
sql/handler.cc:
  Make sure ha_data is reset and ha_data lock is released.
sql/handler.h:
  hton is not supposed to be updated by ha_lock_engine(),
  make it const.
sql/sql_class.cc:
  As thd_{get|set}_ha_data() have some extra logic now, they
  must be implemented on server side.
sql/sql_class.h:
  Added ha_data lock.
2010-04-14 13:53:59 +04:00
Sergey Glukhov
ba229d799a Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
We should disable const subselect item evaluation because
subselect transformation does not happen in view_prepare_mode
and thus val_...() methods can not be called.


mysql-test/r/ctype_ucs.result:
  test case
mysql-test/r/view.result:
  test case
mysql-test/t/ctype_ucs.test:
  test case
mysql-test/t/view.test:
  test case
sql/item.cc:
  disabled const subselect item evaluation in
  view prepare mode.
sql/item_subselect.cc:
  added Item_subselect::safe_charset_converter which
  prevents const item evaluation in view prepare mode.
sql/item_subselect.h:
  added Item_subselect::safe_charset_converter which
  prevents const item evaluation in view prepare mode.
2010-04-06 12:26:59 +05:00
Sergey Glukhov
c1ad5072b8 Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
The problem is that we can not use make_cond_for_table().
This function relies on used_tables() condition
which is not set properly for subqueries.
As result subquery is not filtered out.
The fix is to use remove_eq_conds() function instead
of make_cond_for_table() func. 'remove_eq_conds()'
algorithm relies on const_item() value and it allows
to handle subqueries in right way.


mysql-test/r/having.result:
  test case
mysql-test/t/having.test:
  test case
sql/sql_select.cc:
  The fix is to use remove_eq_conds() function instead
  of make_cond_for_table() function.
2010-04-05 16:10:26 +05:00
Gleb Shchepa
e2a546aef4 Bug #40625: Concat fails on DOUBLE values in a Stored
Procedure, while DECIMAL works

Selecting of the CONCAT(...<SP variable>...) result into
a user variable may return wrong data.


Item_func_concat::val_str contains a number of memory
allocation-saving tricks. One of them concatenates
strings inplace inserting the value of one string
at the beginning of the other string. However,
this trick didn't care about strings those points
to the same data buffer: this is possible when
a CONCAT() parameter is a stored procedure variable -
Item_sp_variable::val_str() uses the intermediate
Item_sp_variable::str_value field, where it may
store a reference to an external buffer.


The Item_func_concat::val_str function has been
modified to take into account val_str functions
(such as Item_sp_variable::val_str) that return
a pointer to an internal Item member variable
that may reference to a buffer provided.


mysql-test/r/func_concat.result:
  Test case for the bug #40625.
mysql-test/t/func_concat.test:
  Test case for the bug #40625.
sql/item_strfunc.cc:
  Bug #40625: Concat fails on DOUBLE values in a Stored
              Procedure, while DECIMAL works
  
  The Item_func_concat::val_str function has been
  modified to take into account val_str functions
  (such as Item_sp_variable::val_str) that return
  a pointer to an internal Item member variable
  that may reference to a buffer provided.
2010-04-03 00:30:22 +04:00
Anurag Shekhar
ab8ff15cd1 Bug #47904 Incorrect results w/ table subquery, derived SQs, and LEFT JOIN
on index

'my_decimal' class has two members which can be used to access the 
value. The member variable buf (inherited from parent class decimal_t) 
is set to member variable buffer so that both are pointing to same value.

Item_copy_decimal::copy() uses memcpy to clone 'my_decimal'. The member
buffer is declared as an array and memcpy results in copying the values
of the array, but the inherited member buf, which should be pointing at
the begining of the array 'buffer' starts pointing to the begining of 
buffer in original object (which is being cloned). Further updates on 
'my_decimal' updates only the inherited member 'buf' but leaves 
buffer unchanged.

Later when the new object (which now holds a inconsistent value) is cloned
again using proper cloning function 'my_decimal2decimal' the buf pointer
is fixed resulting in loss of the current value.

Using my_decimal2decimal instead of memcpy in Item_copy_decimal::copy()
fixed this problem.


mysql-test/r/subselect.result:
  Updated result file after addding test case for bug#47904.
mysql-test/t/subselect.test:
  Added test case for bug#47904.
sql/item.cc:
  Memcopy shouldn't be used to clone my_decimal. Use my_decimal2decimal
  instead.
2010-04-02 01:35:36 +05:30
Georgi Kodinov
2a873bc03e merge 2010-04-01 14:04:45 +03:00
Georgi Kodinov
e65caec138 Bug #37168: Missing variable - skip_name_resolve
Added a read-only global boolean variable skip_name_resolve.
2010-03-31 16:12:37 +03:00
Ramil Kalimullin
55852670cc Fix for bug#52397: another crash with explain extended and group_concat
Problem: EXPLAIN EXTENDED was trying to resolve references to 
freed temporary table fields for GROUP_CONCAT()'s ORDER BY arguments.

Fix: use stored original GROUP_CONCAT()'s arguments in such a case.


mysql-test/r/func_gconcat.result:
  Fix for bug#52397: another crash with explain extended and group_concat
    - test result.
mysql-test/t/func_gconcat.test:
  Fix for bug#52397: another crash with explain extended and group_concat
    - test case.
sql/item_sum.cc:
  Fix for bug#52397: another crash with explain extended and group_concat
    - use "pargs", printing ORDER BY arguments in the 
  Item_func_group_concat::print() instead of "order" to avoid
  possible reference resolving to (freed) temporary table fields.
2010-03-31 17:00:56 +04:00
Sergey Glukhov
6eca53f1d3 fixed compiler warning 2010-03-29 18:42:49 +05:00
Sergey Glukhov
f57839cd60 Bug#52177 crash with explain, row comparison, join, text field
The crash is the result of an attempt made by JOIN::optimize to evaluate
the WHERE condition when no records have been actually read.
The fix is to remove erroneous 'outer_join' variable check.


mysql-test/r/join.result:
  test result
mysql-test/t/join.test:
  test case
sql/sql_select.cc:
  removed erroneous 'outer_join' variable check.
2010-03-26 11:44:24 +04:00
Sergey Glukhov
bccf219bfc Bug#48483 crash in get_best_combination()
The crash happens because greedy_serach
can not determine best plan due to
wrong inner table dependences. These
dependences affects join table sorting
which performs before greedy_search starting.
In our case table which has real 'no dependences'
should be put on top of the list but it does not
happen as inner tables have no dependences as well.
The fix is to exclude RAND_TABLE_BIT mask from
condition which checks if table dependences
should be updated.


mysql-test/r/join.result:
  test result
mysql-test/t/join.test:
  test case
sql/sql_select.cc:
  RAND_TABLE_BIT mask should not be counted as it
  prevents update of inner table dependences.
  For example it might happen if RAND() function
  is used in JOIN ON clause.
2010-03-24 14:37:28 +04:00
Sergey Glukhov
3658bde736 5.0-bugteam->5.1-bugteam merge 2010-03-26 11:46:18 +04:00
Tatiana A. Nurnberg
28e95ba535 Bug#48525: trigger changes "Column 'id' cannot be null" behaviour
CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL;
UPDATE...SET...NULL on NOT NULL fields behaved differently after
a trigger.

Now distinguishes between IGNORE and ERROR_FOR_NULL and save/restores
check-field options.


mysql-test/r/trigger.result:
  Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently
  when run after a trigger.
mysql-test/t/trigger.test:
  Show that UPDATE...SET...NULL on NOT NULL columns doesn't behave differently
  when run after a trigger.
sql/field_conv.cc:
  CHECK_FIELD_IGNORE was treated as CHECK_FIELD_ERROR_FOR_NULL.
  Distinguish between the two.
sql/sp_head.cc:
  Raise error as needed.
sql/sql_class.cc:
  Save and restore check-fields options.
sql/sql_class.h:
  Make room so we can save check-fields options.
sql/sql_insert.cc:
  Raise error as needed.
2010-03-29 03:32:30 +01:00
unknown
454c003a5c Bug #50407 mysqlbinlog --database=X produces bad output for SAVEPOINTs
When mysqlbinlog was given the --database=X flag, it always printed
'ROLLBACK TO', but the corresponding 'SAVEPOINT' statement was not
printed. The replicated filter(replicated-do/ignore-db) and binlog
filter (binlog-do/ignore-db) has the same problem. They are solved
in this patch together.

After this patch, We always check whether the query is 'SAVEPOINT'
statement or not. Because this is a literal check, 'SAVEPOINT' and
'ROLLBACK TO' statements are also binlogged in uppercase with no
any comments.

The binlog before this patch can be handled correctly except one case
that any comments are in front of the keywords. for example:
 /* bla bla */ SAVEPOINT a;
 /* bla bla */ ROLLBACK TO a;
2010-03-28 19:57:33 +08:00
unknown
4775601012 Bug #50095 Multi statement including CREATE EVENT causes rotten binlog entry
The log event of 'CREATE EVENT' was being binlogged with garbage
at the end of the query if 'CREATE EVENT' is followed by another SQL statement
and they were executed as one command.
for example:
    DELIMITER |;
    CREATE EVENT e1 ON EVERY DAY DO SELECT 1; SELECT 'a';
    DELIMITER ;|
When binlogging 'CREATE EVENT', we always create a new statement with definer
and write it into the log event. The new statement is made from cpp_buf(preprocessed buffer).
which is not a c string(end with '\0'), but it is copied as a c string.

In this patch, cpp_buf is copied with its length.
2010-03-28 16:37:47 +08:00
Sergey Glukhov
d5325c7793 Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149
The crash happens because of incorrect max_length calculation
in QUOTE function(due to overflow). max_length is set
to 0 and it leads to assert failure.
The fix is to cast expression result to
ulonglong variable and adjust it if the
result exceeds MAX_BLOB_WIDTH.


mysql-test/r/func_str.result:
  test case
mysql-test/t/func_str.test:
  test case
sql/item_strfunc.h:
  cast expression result to ulonglong variable and
  adjust it if the result exceeds MAX_BLOB_WIDTH.
2010-03-26 09:49:35 +04:00
Andrei Elkin
f05d975284 merge from 5.1-bt rep 2010-03-25 18:13:23 +02:00
Sergey Vojtovich
3b091bbaf4 Merge fixes for BUG51877, BUG51866, BUG47598 to mysql-5.1-bugteam. 2010-03-25 19:59:54 +04:00
Andrei Elkin
dc62faf440 merging bug#52304 to 5.1-bt,pe 2010-03-25 14:49:24 +02:00
Sergey Vojtovich
5eff6aed0e Merge fix for BUG51866 to mysql-5.1-bugteam. 2010-03-25 16:11:16 +04:00