List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:February 20 2009 9:30am
Subject:bzr commit into mysql-6.0 branch (alik:2727) Bug#34828
View as plain text  
#At file:///mnt/raid/alik/MySQL/bzr/bug34828/6.0-rt-bu34828/ based on revid:alik@stripped

 2727 Alexander Nozdrin	2009-02-20
      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.
      modified:
        mysql-test/r/variables.result
        mysql-test/t/variables.test
        sql/set_var.cc

per-file messages:
  sql/set_var.cc
    Accept a keyword only when it matches completely.
=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2009-01-31 15:53:35 +0000
+++ b/mysql-test/r/variables.result	2009-02-20 09:30:07 +0000
@@ -1341,3 +1341,30 @@ SET @@session.thread_stack= 7;
 ERROR HY000: Variable 'thread_stack' is a read only variable
 SET @@global.thread_stack= 7;
 ERROR HY000: Variable 'thread_stack' is a read only variable
+
+#
+# Bug#34828: OF is taken as OFF and a value of 0 is set for variable 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;
+
+# End of Bug#34828.
+

=== modified file 'mysql-test/t/variables.test'
--- a/mysql-test/t/variables.test	2009-02-02 23:28:17 +0000
+++ b/mysql-test/t/variables.test	2009-02-20 09:30:07 +0000
@@ -1083,3 +1083,35 @@ SET @@session.thread_stack= 7;
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET @@global.thread_stack= 7;
 #
+
+###########################################################################
+
+--echo
+--echo #
+--echo # Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes.
+--echo #
+--echo
+
+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 # End of Bug#34828.
+--echo
+
+###########################################################################

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	2009-02-05 12:49:39 +0000
+++ b/sql/set_var.cc	2009-02-20 09:30:07 +0000
@@ -1835,7 +1835,7 @@ bool sys_var::check_enum(THD *thd, set_v
     if (!(res=var->value->val_str(&str)) ||
 	((long) (var->save_result.ulong_value=
 		 (ulong) find_type(enum_names, res->ptr(),
-				   res->length(),1)-1)) < 0)
+				   res->length(), FALSE) - 1)) < 0)
     {
       value= res ? res->c_ptr() : "NULL";
       goto err;

Thread
bzr commit into mysql-6.0 branch (alik:2727) Bug#34828Alexander Nozdrin20 Feb
  • Re: bzr commit into mysql-6.0 branch (alik:2727) Bug#34828Konstantin Osipov20 Feb