Commit 5281fa36 authored by Alexander Nozdrin's avatar Alexander Nozdrin

A backport a patch of Bug#34828.

Original revision is from mysql-6.0-codebase:

revno: 2617.23.13
committer: Alexander Nozdrin <alik@sun.com>
branch nick: 6.0-rt-bug34828
timestamp: Tue 2009-02-24 14:25:46 +0300
message:
  A patch for Bug#34828: OF is taken as OFF and a value of 0
  is set for variable SQL_notes.
  
  The problem was that partial match was allowed for keywords.
  
  A fix is to disable partial match and require full match.
parent 93848350
...@@ -1488,3 +1488,168 @@ SELECT @@GLOBAL.max_binlog_cache_size; ...@@ -1488,3 +1488,168 @@ SELECT @@GLOBAL.max_binlog_cache_size;
5368709120 5368709120
SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size; SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size;
End of 5.1 tests End of 5.1 tests
#
# Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes.
#
# Checking sql_notes...
SET @sql_notes_saved = @@sql_notes;
SET @@sql_notes = ON;
SELECT @@sql_notes;
@@sql_notes
1
SET @@sql_notes = OF;
ERROR 42000: Variable 'sql_notes' can't be set to the value of 'OF'
SELECT @@sql_notes;
@@sql_notes
1
SET @@sql_notes = OFF;
SELECT @@sql_notes;
@@sql_notes
0
SET @@sql_notes = @sql_notes_saved;
# Checking delay_key_write...
SET @delay_key_write_saved = @@delay_key_write;
SET GLOBAL delay_key_write = ON;
SELECT @@delay_key_write;
@@delay_key_write
ON
SET GLOBAL delay_key_write = OF;
ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'OF'
SELECT @@delay_key_write;
@@delay_key_write
ON
SET GLOBAL delay_key_write = AL;
ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'AL'
SELECT @@delay_key_write;
@@delay_key_write
ON
SET GLOBAL delay_key_write = OFF;
SELECT @@delay_key_write;
@@delay_key_write
OFF
SET GLOBAL delay_key_write = ALL;
SELECT @@delay_key_write;
@@delay_key_write
ALL
SET GLOBAL delay_key_write = @delay_key_write_saved;
# Checking sql_safe_updates...
SET @sql_safe_updates_saved = @@sql_safe_updates;
SET @@sql_safe_updates = ON;
SELECT @@sql_safe_updates;
@@sql_safe_updates
1
SET @@sql_safe_updates = OF;
ERROR 42000: Variable 'sql_safe_updates' can't be set to the value of 'OF'
SELECT @@sql_safe_updates;
@@sql_safe_updates
1
SET @@sql_safe_updates = OFF;
SELECT @@sql_safe_updates;
@@sql_safe_updates
0
SET @@sql_safe_updates = @sql_safe_updates_saved;
# Checking foreign_key_checks...
SET @foreign_key_checks_saved = @@foreign_key_checks;
SET @@foreign_key_checks = ON;
SELECT @@foreign_key_checks;
@@foreign_key_checks
1
SET @@foreign_key_checks = OF;
ERROR 42000: Variable 'foreign_key_checks' can't be set to the value of 'OF'
SELECT @@foreign_key_checks;
@@foreign_key_checks
1
SET @@foreign_key_checks = OFF;
SELECT @@foreign_key_checks;
@@foreign_key_checks
0
SET @@foreign_key_checks = @foreign_key_checks_saved;
# Checking unique_checks...
SET @unique_checks_saved = @@unique_checks;
SET @@unique_checks = ON;
SELECT @@unique_checks;
@@unique_checks
1
SET @@unique_checks = OF;
ERROR 42000: Variable 'unique_checks' can't be set to the value of 'OF'
SELECT @@unique_checks;
@@unique_checks
1
SET @@unique_checks = OFF;
SELECT @@unique_checks;
@@unique_checks
0
SET @@unique_checks = @unique_checks_saved;
# Checking sql_buffer_result...
SET @sql_buffer_result_saved = @@sql_buffer_result;
SET @@sql_buffer_result = ON;
SELECT @@sql_buffer_result;
@@sql_buffer_result
1
SET @@sql_buffer_result = OF;
ERROR 42000: Variable 'sql_buffer_result' can't be set to the value of 'OF'
SELECT @@sql_buffer_result;
@@sql_buffer_result
1
SET @@sql_buffer_result = OFF;
SELECT @@sql_buffer_result;
@@sql_buffer_result
0
SET @@sql_buffer_result = @sql_buffer_result_saved;
# Checking sql_quote_show_create...
SET @sql_quote_show_create_saved = @@sql_quote_show_create;
SET @@sql_quote_show_create = ON;
SELECT @@sql_quote_show_create;
@@sql_quote_show_create
1
SET @@sql_quote_show_create = OF;
ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'OF'
SELECT @@sql_quote_show_create;
@@sql_quote_show_create
1
SET @@sql_quote_show_create = OFF;
SELECT @@sql_quote_show_create;
@@sql_quote_show_create
0
SET @@sql_quote_show_create = @sql_quote_show_create_saved;
# End of Bug#34828.
...@@ -1227,3 +1227,165 @@ SET GLOBAL max_binlog_cache_size = 5 * 1024 * 1024 * 1024; ...@@ -1227,3 +1227,165 @@ SET GLOBAL max_binlog_cache_size = 5 * 1024 * 1024 * 1024;
SELECT @@GLOBAL.max_binlog_cache_size; SELECT @@GLOBAL.max_binlog_cache_size;
SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size; SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size;
--echo End of 5.1 tests --echo End of 5.1 tests
###########################################################################
--echo
--echo #
--echo # Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes.
--echo #
--echo
--echo # Checking sql_notes...
SET @sql_notes_saved = @@sql_notes;
--echo
SET @@sql_notes = ON;
SELECT @@sql_notes;
--echo
--error ER_WRONG_VALUE_FOR_VAR
SET @@sql_notes = OF;
SELECT @@sql_notes;
--echo
SET @@sql_notes = OFF;
SELECT @@sql_notes;
--echo
SET @@sql_notes = @sql_notes_saved;
--echo
--echo # Checking delay_key_write...
SET @delay_key_write_saved = @@delay_key_write;
--echo
SET GLOBAL delay_key_write = ON;
SELECT @@delay_key_write;
--echo
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL delay_key_write = OF;
SELECT @@delay_key_write;
--echo
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL delay_key_write = AL;
SELECT @@delay_key_write;
--echo
SET GLOBAL delay_key_write = OFF;
SELECT @@delay_key_write;
--echo
SET GLOBAL delay_key_write = ALL;
SELECT @@delay_key_write;
--echo
SET GLOBAL delay_key_write = @delay_key_write_saved;
--echo
--echo # Checking sql_safe_updates...
SET @sql_safe_updates_saved = @@sql_safe_updates;
--echo
SET @@sql_safe_updates = ON;
SELECT @@sql_safe_updates;
--echo
--error ER_WRONG_VALUE_FOR_VAR
SET @@sql_safe_updates = OF;
SELECT @@sql_safe_updates;
--echo
SET @@sql_safe_updates = OFF;
SELECT @@sql_safe_updates;
--echo
SET @@sql_safe_updates = @sql_safe_updates_saved;
--echo
--echo # Checking foreign_key_checks...
SET @foreign_key_checks_saved = @@foreign_key_checks;
--echo
SET @@foreign_key_checks = ON;
SELECT @@foreign_key_checks;
--echo
--error ER_WRONG_VALUE_FOR_VAR
SET @@foreign_key_checks = OF;
SELECT @@foreign_key_checks;
--echo
SET @@foreign_key_checks = OFF;
SELECT @@foreign_key_checks;
--echo
SET @@foreign_key_checks = @foreign_key_checks_saved;
--echo
--echo # Checking unique_checks...
SET @unique_checks_saved = @@unique_checks;
--echo
SET @@unique_checks = ON;
SELECT @@unique_checks;
--echo
--error ER_WRONG_VALUE_FOR_VAR
SET @@unique_checks = OF;
SELECT @@unique_checks;
--echo
SET @@unique_checks = OFF;
SELECT @@unique_checks;
--echo
SET @@unique_checks = @unique_checks_saved;
--echo
--echo # Checking sql_buffer_result...
SET @sql_buffer_result_saved = @@sql_buffer_result;
--echo
SET @@sql_buffer_result = ON;
SELECT @@sql_buffer_result;
--echo
--error ER_WRONG_VALUE_FOR_VAR
SET @@sql_buffer_result = OF;
SELECT @@sql_buffer_result;
--echo
SET @@sql_buffer_result = OFF;
SELECT @@sql_buffer_result;
--echo
SET @@sql_buffer_result = @sql_buffer_result_saved;
--echo
--echo # Checking sql_quote_show_create...
SET @sql_quote_show_create_saved = @@sql_quote_show_create;
--echo
SET @@sql_quote_show_create = ON;
SELECT @@sql_quote_show_create;
--echo
--error ER_WRONG_VALUE_FOR_VAR
SET @@sql_quote_show_create = OF;
SELECT @@sql_quote_show_create;
--echo
SET @@sql_quote_show_create = OFF;
SELECT @@sql_quote_show_create;
--echo
SET @@sql_quote_show_create = @sql_quote_show_create_saved;
--echo
--echo # End of Bug#34828.
--echo
###########################################################################
...@@ -1796,7 +1796,7 @@ bool sys_var::check_enum(THD *thd, set_var *var, const TYPELIB *enum_names) ...@@ -1796,7 +1796,7 @@ bool sys_var::check_enum(THD *thd, set_var *var, const TYPELIB *enum_names)
if (!(res=var->value->val_str(&str)) || if (!(res=var->value->val_str(&str)) ||
((long) (var->save_result.ulong_value= ((long) (var->save_result.ulong_value=
(ulong) find_type(enum_names, res->ptr(), (ulong) find_type(enum_names, res->ptr(),
res->length(),1)-1)) < 0) res->length(), FALSE) - 1)) < 0)
{ {
value= res ? res->c_ptr() : "NULL"; value= res ? res->c_ptr() : "NULL";
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment