Commit graph

25116 commits

Author SHA1 Message Date
Sergey Petrunia
64ed42d09e Merge @@optimizer_switch no_xxx -> xxx=off change to 6.0 2009-03-19 15:22:08 +03:00
Staale Smedseng
6725f3efd6 Merge from 5.0-bugteam 2009-03-19 11:44:57 +01:00
Staale Smedseng
28f4090bda Bug #42502 huge memory leak possible with timezone
functions
      
Unknown timezone specifications are properly rejected
by the server, but are copied into tz_storage before
rejection, and hence is retained until end of server 
life. With sufficiently large bogus timezone specs, 
it is easy to exhaust system memory.
      
Allocation of memory for a copy of the timezone
name is delayed until after verification of validity,
at the cost of a memcpy of the timezone info. This 
only happens once, future lookups will hit the cached
structure.
2009-03-19 11:27:45 +01:00
Sergey Glukhov
2ea2cc02c3 5.0-bugteam->5.1-bugteam merge 2009-03-19 13:26:12 +04:00
Sergey Glukhov
af016f72b9 Bug#41627 Illegal mix of collations in LEAST / GREATEST / CASE
Don't throw an error after checking the first and the second arguments.
Continue with checking the third and higher arguments and if some of
them is stronger according to coercibility rules,
then this argument's collation is set as result collation.


mysql-test/r/ctype_collate.result:
  test result
mysql-test/t/ctype_collate.test:
  test case
sql/item.cc:
  Don't throw an error after checking the first and the second arguments.
  Continue with checking the third and higher arguments and if some of
  them is stronger according to coercibility rules,
  then this argument's collation is set as result collation.
2009-03-19 12:20:28 +04:00
Sergey Petrunia
5b8156e07f Merge 2009-03-18 19:08:54 +03:00
Tatiana A. Nurnberg
a8fad0c923 auto-merge 2009-03-18 13:31:35 +01:00
Guangbao Ni
224376a796 Auto-merge from 5.1-bugteam 2009-03-18 15:02:06 +00:00
Guangbao Ni
0ba1cc2523 Bug #42217 mysql.procs_priv does not get replicated
mysql.procs_priv table itself does not get replicated.
Inserting routine privilege record into mysql.procs_priv table
is triggered by creating function/procedure statements
according to current user's privileges.
Because the current user of SQL thread has GLOBAL_ACL,
which doesn't need any check mysql.procs_priv privilege
when create/alter/execute routines.
Corresponding GLOBAL_ACL privilege user
doesn't insert routine privilege record into
mysql.procs_priv when creating a routine.

Fixed by switching the current user of SQL thread to definer user if
the definer user exists on slave.
That populates procs_priv, otherwise to keep the SQL thread
user and procs_priv remains unchanged.


mysql-test/suite/rpl/r/rpl_do_grant.result:
  Test case result for routine privilege when definer user exist or not on slave
mysql-test/suite/rpl/t/rpl_do_grant.test:
  Test case result for routine privilege when definer user exist or not on slave
sql/sql_parse.cc:
  Switch current user of SQL thread to definer user if the definer user
  existes on slave when checking whether the routine privilege is
  needed to insert mysql.procs_priv table or not.
2009-03-18 13:48:23 +00:00
Sergey Petrunia
79d59cca8e Merge 2009-03-18 14:32:32 +03:00
Georgi Kodinov
b27465c28a auto-merge 2009-03-17 16:32:44 +02:00
Georgi Kodinov
9de51e418b Bug 22047: Time in SHOW PROCESSLIST for SQL thread in replication seems to
become negative

- merged the fix to 5.1
- extended to cover I_S.PROCESSLIST.TIME
- Changed the column type of I_S.PROCESSLIST.TIME from LOGNLONG
  UNSIGNED
  to LONG (to match the SHOW PROCESSLIST type)
- Added a test case
2009-03-17 16:29:16 +02:00
Ramil Kalimullin
44f6c2937d Code clean-up.
sql/sql_select.cc:
  the if() separate arguments checks are slightly faster.
2009-03-17 11:04:15 +04:00
Sergey Petrunia
076eb7a67a Fix wrong parameter name which caused compile failure on windows 2009-03-16 20:45:03 +03:00
Sergey Petrunia
d5b9c14513 Merge 2009-03-16 20:10:03 +03:00
Sergey Petrunia
0165ca88cf @@optimizer_switch switch from no_xxx to xxx={on|off} syntax:
- Fix valgrind warning on attempt to run a "SET optimizer_switch=number" statement.
  Need to call c_ptr_safe() as strings returned by non-string items are not 
  necessarily null-terminated.
2009-03-16 20:02:55 +03:00
Alexey Kopytov
15baa13f84 Manual merge of patch for bug #40552 into the team tree.
Replaced a call to load_defaults() in sql_plugin.cc with 
its thread-safe version.
2009-03-16 13:37:13 +03:00
Leonard Zhou
53849a24f9 Merge 2009-03-16 17:06:22 +08:00
Leonard Zhou
b42c29cfe3 BUG#22504 load data infile sql statement in replication architecture get error
The problem is issued because we set wrong start position and stop position of query string into binlog.
That two values are stored as part of head info of query string.
When we parse binlog, we first get position values then get the query string according position values.
But seems that two values are not calculated correctly after the parse of Yacc.

We don't want to touch so much of yacc because it may influence other codes.
So just add one space after 'INTO' key word when parsing.
This can easily resolve the problem.

mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
  Test result
mysql-test/suite/rpl/t/rpl_loaddatalocal.test:
  Test case
sql/log_event.cc:
  Add space after 'INTO'.
2009-03-16 16:21:29 +08:00
Ramil Kalimullin
0fd7a359da Fix for bug #42957: no results from
select where .. (col=col and col=col) or ... (false expression)

Problem: optimizer didn't take into account a singular case 
when we eliminated all the predicates at the AND level of WHERE.
That may lead to wrong results.

Fix: replace (a=a AND a=a...) with TRUE if we eliminated all the
predicates.


mysql-test/r/select.result:
  Fix for bug #42957: no results from 
  select where .. (col=col and col=col) or ... (false expression)
    - test result.
mysql-test/t/select.test:
  Fix for bug #42957: no results from 
  select where .. (col=col and col=col) or ... (false expression)
    - test case.
sql/sql_select.cc:
  Fix for bug #42957: no results from 
  select where .. (col=col and col=col) or ... (false expression)
    - replacing equality predicates by multiple equality items check
  if we eliminate all the predicates at the AND level and 
  replace them with TRUE if so.
2009-03-16 09:02:10 +04:00
Sergey Petrunia
3f0a54e35e Merge 2009-03-14 22:04:31 +03:00
Sergey Petrunia
6551e173f9 @@optimizer_switch backport and change from no_xxx to xx=on|off: post-review fixes
mysql-test/r/index_merge_myisam.result:
  More tests
mysql-test/t/index_merge_myisam.test:
  More tests
2009-03-14 21:58:23 +03:00
Georgi Kodinov
f35b4218ea Bug #22047 : Time in SHOW PROCESSLIST for SQL thread in replication
seems to become negative

THD::start_time has a dual meaning : it's either the time since the process
entered a given state or is the transaction time returned by e.g. NOW().
This causes problems, as sometimes THD::start_time may be set to a value
that is correct and needed when used as a base for NOW(), but these times
may be arbitrary (SET @@timestamp) or non-local (coming from the master 
through the replication feed).
If one such non-local time is set there's no way to return a correct value
for e.g. SHOW PROCESSLIST or SELECT ... FROM INFORMATION_SCHEMA.PROCESSLIST.
Fixed by making the Time column in SHOW PROCESSLIST SIGNED LONG instead of 
UNSIGNED LONG and doing the correct conversions.
      
Note that no reliable test suite can be constructed, since it would require
knowing the local time and can't be achieved by the means of the current test
suite.

sql/sql_show.cc:
  Bug #22047: make the Time in SHOW PROCESSLIST LONG from 
  LONG UNSIGNED
2009-03-13 15:51:25 +02:00
Sergey Glukhov
7b2d7bea5e compilation(embedded server) failure fix 2009-03-13 14:25:50 +04:00
Sergey Glukhov
a5dc03fb68 Bug#42610 Dynamic plugin broken in 5.1.31
--added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage
--option 'ignore-builtin-innodb' disables all InnoDB builtin plugins
  (including I_S plugins)


sql/mysql_priv.h:
  --added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage
sql/mysqld.cc:
  --added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage
sql/sql_plugin.cc:
  --added ability to obtain plugin variables from my.cnf on INSTALL PLUGIN stage
  --option 'ignore-builtin-innodb' disables all InnoDB builtin plugins
    (including I_S plugins)
2009-03-13 12:51:25 +04:00
Tatiana A. Nurnberg
8370242323 manual merge for 40657 beautification 2009-03-12 17:55:10 +01:00
Tatiana A. Nurnberg
59fbffa45c Bug#40657: assertion with out of range variables and traditional sql_mode
normalize error-messages

mysql-test/r/variables.result:
  show that warning uses underscore
  (sysvar-name), not hyphens (option-name)
mysql-test/t/variables.test:
  show that warning uses underscore
  (sysvar-name), not hyphens (option-name)
sql/set_var.cc:
  normalize error-messages
2009-03-11 23:32:53 +01:00
Sergey Petrunia
5d55f7c543 Merge 2009-03-11 23:52:22 +03:00
Davi Arnaut
402bc523b2 Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id
The problem is that creating a event could fail if the value of
the variable server_id didn't fit in the originator column of
the event system table. The cause is two-fold: it was possible
to set server_id to a value outside the documented range (from
0 to 2^32-1) and the originator column of the event table didn't
have enough room for values in this range.

The log tables (general_log and slow_log) also don't have a proper
column type to store the server_id and having a large server_id
value could prevent queries from being logged.

The solution is to ensure that all system tables that store the
server_id value have a proper column type (int unsigned) and that
the variable can't be set to a value that is not within the range.

mysql-test/r/events_bugs.result:
  Add test case result for Bug#36540
mysql-test/r/log_tables.result:
  Update column type.
mysql-test/r/system_mysql_db.result:
  Update column type.
mysql-test/r/variables.result:
  Add test case result for server_id value range.
mysql-test/suite/sys_vars/r/server_id_basic_64.result:
  Update test case results.
mysql-test/t/events_bugs.test:
  Add test case for Bug#36540
mysql-test/t/log_tables.test:
  Fix column type.
mysql-test/t/variables.test:
  Add test case for server_id value range.
scripts/mysql_system_tables.sql:
  Columns that store the server_id value must be of type INT UNSIGNED,
  fix event (originator), general_log and slow_log (server_id) tables
  in accordance.
scripts/mysql_system_tables_fix.sql:
  Columns that store the server_id value must be of type INT UNSIGNED,
  fix event (originator), general_log and slow_log (server_id) tables
  in accordance.
sql/mysqld.cc:
  Set min and max values for the server_id variable.
  Unfortunately we can't easily change server_id variable type
  from ulong to uint32 because of the sys_var classes.
2009-03-11 17:30:56 -03:00
Sergey Petrunia
fd35040890 Change optimizer_switch from no_xxx to xxx=on/xx=off.
mysql-test/r/index_merge_myisam.result:
  Testcases
mysql-test/t/index_merge_myisam.test:
  Testcases
sql/strfunc.cc:
  Change optimizer_switch from no_xxx to xxx=on/xx=off.
  - Add functions to parse the new syntax
2009-03-11 23:13:39 +03:00
Tatiana A. Nurnberg
e976b27ea6 Bug#36751: Segmentation fault in ctype-bin.c:308; Linux 86_64, with-max-indexes=128
mysqld is optimized for the default
case (up to 64-indices); for a greater
number of indices it goes through a
different code path. As that code-path
is a compile-time option and can not
easily be covered in standard tests,
bitrot occurred. key-fields need an
explicit initialization in the non-
optimized case; this setup was
presumably not added when a new key-
vector was added.

Changeset adds the necessary
initialisations.

No test case added due to dependence
on compile-time option.

sql/sql_select.cc:
  Init merge_keys as well. If we don't,
  things blow up badly outside of the
  optimized-for-64-keys case!
sql/table.cc:
  Init merge_keys as well. If we don't,
  things blow up badly outside of the
  optimized-for-64-keys case!
2009-03-11 19:09:56 +01:00
Georgi Kodinov
f79cb0de91 merge of bug 42434 to 5.1-bugteam 2009-03-11 18:13:42 +02:00
Georgi Kodinov
ba1b5eb4b5 merged bug 43354 to 5.1-bugteam 2009-03-11 14:29:59 +02:00
Georgi Kodinov
d3d6f4fdad Bug #43354: Use key hint can crash server in explain extended query
The copy of the original arguments of a aggregate function was not
initialized until after fix_fields().
Sometimes (e.g. when there's an error processing the statement)
the print() can be called with no corresponding fix_fields() call.
      
Fixed by adding a check if the Item is fixed before using the arguments
copy.

mysql-test/r/explain.result:
  Bug #43354: test case
mysql-test/t/explain.test:
  Bug #43354: test case
sql/item_sum.cc:
  Bug #43354: use the argument list copy only if it's initialized
2009-03-11 14:10:44 +02:00
Sergey Petrunia
989ee96b64 Post-merge fixes 2009-03-10 11:49:30 +03:00
Sergey Petrunia
632a33f8fc Merge 2009-03-10 00:53:38 +03:00
Georgi Kodinov
3033ea85a2 Bug #42434: license of mysys MD5 implementation is not GPL-compatible
Took the Xfree implementation (based on the same rewrite as the NDB one)
and added it instead of the current implementation.
Added a macro to make the calls to MD5 more streamlined. 

client/mysqlmanager-pwgen.c:
  Bug #42434: changed to call the macro
include/my_md5.h:
  Bug #42434: use the Xfree implementation
mysys/md5.c:
  Bug #42434: use the Xfree implementation
sql/item_strfunc.cc:
  Bug #42434: changed to call the macro
sql/table.cc:
  Bug #42434: changed to call the macro
tools/mysqlmanager.c:
  Bug #42434: changed to call the macro
2009-03-09 20:57:03 +02:00
Georgi Kodinov
7541fec52d fixed a typo 2009-03-09 12:49:18 +02:00
Georgi Kodinov
56ae3bd155 fixed a win32 compile warning 2009-03-09 12:22:52 +02:00
Tatiana A. Nurnberg
cee070e1bb manual merge 2009-03-06 16:11:34 +01:00
Kristofer Pettersson
55c779cdbf Manual merge 2009-03-06 11:49:39 +01:00
Tatiana A. Nurnberg
13328b0f45 Bug#40657: assertion with out of range variables and traditional sql_mode
Some changes that make things more elegant in 6.0,
backported so the code is mostly the same in 5.1,
for easier maintainence.

sql/set_var.cc:
  Backporting some changes to 5.1 so the code is
  mostly the same in both versions. Less to learn!
2009-03-05 16:42:12 +01:00
Kristofer Pettersson
ac821c6570 Bug#40363 Bug 20023 is not fixed on 5.0
This is a back port from 5.1 to 5.0.

Fix for BUG 20023: mysql_change_user() resets the value
of SQL_BIG_SELECTS.
  
The bug was that SQL_BIG_SELECTS was not properly set
in COM_CHANGE_USER.
  
The fix is to update SQL_BIG_SELECTS properly.



sql/sql_class.cc:
  Update THD::options with the respect to SQL_BIG_SELECTS
  in COM_CHANGE_USER.
tests/mysql_client_test.c:
  Add a test case BUG#20023.
2009-03-05 13:37:46 +01:00
Davi Arnaut
53802ae6ca Bug#41465: confusing error message when comment is too long
The problem was that the server was trying to use the unknown
error format string (ER_UNKNOWN_ERROR) to print messages about
comments being too long, but the said format string does not
accept arguments and will always default to "Unknown error".

The solution is to introduce new error messages which are
specific to the error conditions so that server wants to
signal -- this also means that it's possible to translate
those messages.

mysql-test/r/strict.result:
  Update test case result.
mysql-test/t/strict.test:
  Update test case with new errors.
sql/share/errmsg.txt:
  Introduce new errors for long comments.
sql/unireg.cc:
  Use new errors.
2009-03-05 08:20:01 -03:00
Kristofer Pettersson
d40b1be906 Automerge 2009-03-06 10:52:43 +01:00
Narayanan V
e4fd72fa46 merging with mysql-5.1-bugteam tree 2009-03-06 10:45:46 +05:30
Luis Soares
5833903889 BUG#39753: Replication failure on MIXED + bit + myisam + no PK
When using mixed mode the record values stored inside the storage
engine differed from the ones computed from the row event. This
happened because the prepare_record function was calling
empty_record macro causing some don't care bits to be left set.
                          
Replacing the empty_record plus explicitly setting defaults with 
restore_record to restore the record default values fixes this.
2009-03-05 20:54:53 +01:00
Kristofer Pettersson
9db67e1cda Automerge 2009-03-05 15:30:59 +01:00
Kristofer Pettersson
ddaede8087 Bug#39843 DELETE requires write access to table in subquery in where clause
An unnecessarily restrictive lock were taken on sub-SELECTs during DELETE.

During parsing, a global structure is reused for sub-SELECTs and the attribute
keeping track of lock options were not reset properly.
This patch introduces a new attribute to keep track on the syntactical lock
option elements found in a sub-SELECT and then sets the lock options accordingly.

Now the sub-SELECTs will try to acquire a READ lock if possible
instead of a WRITE lock as inherited from the outer DELETE statement.


mysql-test/r/lock.result:
  Added test case for bug39843
mysql-test/t/lock.test:
  Added test case for bug39843
sql/sql_lex.cc:
  * Reset member variable lock_option on each new query.
sql/sql_lex.h:
  * Introduced new member variable 'lock_option' which is keeping track
    of the syntactical lock option of a (sub-)select query.
sql/sql_parse.cc:
  * Wrote comments to functions.
sql/sql_yacc.yy:
  * Introduced an attribute to keep track of syntactical lock options
    in sub-selects.
  * Made sure that the default value TL_READ_DEFAULT is at the begining
    of each subselect-rule.
2009-03-05 15:22:33 +01:00
Sergey Glukhov
abfe3437f7 removed unused variable 2009-03-05 17:23:16 +04:00