List:Commits« Previous MessageNext Message »
From:guilhem Date:January 25 2006 6:53pm
Subject:bk commit into 5.0 tree (guilhem:1.2005) BUG#13897
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of guilhem. When guilhem does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2005 06/01/25 19:53:41 guilhem@stripped +3 -0
  Fix for BUG#13897 "failure to do SET SQL_MODE=N where N is a number > 31" (the original bug's title isn't the simplest symptom):
  sys_var::check_set() was wrong; the patch is a slightly modified version of a suggestion by Monty.

  sql/set_var.cc
    1.148 06/01/25 19:53:37 guilhem@stripped +8 -1
    sys_var::check_set() is to check a set, so "if (tmp>=enum_names->count)" is wrong (this is what would
    be for checking an enum, not a set). We instead check that only reasonable bits of the input are set.
    The expression after the && is to be safe when the enumeration of sql_mode later contains 64 elements.
    It is placed second to be in fact skipped (not evaluated) in normal conditions (correct input + less than 64 elements).

  mysql-test/t/sql_mode.test
    1.17 06/01/25 19:53:37 guilhem@stripped +9 -0
    test for BUG#13897 (setting SQL_MODE by passing a numeric value)

  mysql-test/r/sql_mode.result
    1.33 06/01/25 19:53:37 guilhem@stripped +16 -0
    result update

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	guilhem
# Host:	gbichot3.local
# Root:	/home/mysql_src/mysql-5.0

--- 1.32/mysql-test/r/sql_mode.result	2005-10-27 23:18:10 +02:00
+++ 1.33/mysql-test/r/sql_mode.result	2006-01-25 19:53:37 +01:00
@@ -478,4 +478,20 @@
 create view v2 as select a from t2 where a in (select a from v1);
 drop view v2, v1;
 drop table t1, t2;
+select @@sql_mode;
+@@sql_mode
+ANSI_QUOTES
+set sql_mode=2097152;
+select @@sql_mode;
+@@sql_mode
+STRICT_TRANS_TABLES
+set sql_mode=16384+(65536*4);
+select @@sql_mode;
+@@sql_mode
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI
+set sql_mode=2147483648;
+ERROR 42000: Variable 'sql_mode' can't be set to the value of '2147483648'
+select @@sql_mode;
+@@sql_mode
+REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI
 SET @@SQL_MODE=@OLD_SQL_MODE;

--- 1.16/mysql-test/t/sql_mode.test	2005-10-27 23:18:10 +02:00
+++ 1.17/mysql-test/t/sql_mode.test	2006-01-25 19:53:37 +01:00
@@ -255,4 +255,13 @@
 drop view v2, v1;
 drop table t1, t2;
 
+select @@sql_mode;
+set sql_mode=2097152;
+select @@sql_mode;
+set sql_mode=16384+(65536*4);
+select @@sql_mode;
+--error 1231
+set sql_mode=2147483648; # that mode does not exist
+select @@sql_mode;
+
 SET @@SQL_MODE=@OLD_SQL_MODE;

--- 1.147/sql/set_var.cc	2006-01-18 13:01:54 +01:00
+++ 1.148/sql/set_var.cc	2006-01-25 19:53:37 +01:00
@@ -1656,7 +1656,14 @@
   else
   {
     ulonglong tmp= var->value->val_int();
-    if (tmp >= enum_names->count)
+    /*
+      When the enum is made to contain 64 elements, as 1ULL<<64 is undefined,
+      this will trigger a compiler warning (though safe as the undefined
+      number will not be used) "left shift count >= width of type". It will be
+      simple then to remove the entire if().
+    */
+    if (unlikely((tmp >= ((ULL(1)) << enum_names->count)) &&
+                 (enum_names->count < 64)))
     {
       llstr(tmp, buff);
       goto err;
Thread
bk commit into 5.0 tree (guilhem:1.2005) BUG#13897guilhem25 Jan