List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:October 27 2009 11:07pm
Subject:bzr push into mysql-5.5.0-trunk branch (mikael:2899 to 2900) Bug#48164
View as plain text  
 2900 Mikael Ronstrom	2009-10-28
      Fixed sql_mode issue in BUG#48164, will ignore sql_mode when generating constants, also warnings will not be tolerated
      modified:
        mysql-test/r/partition_column.result
        mysql-test/t/partition_column.test
        sql/partition_info.cc

 2899 Mikael Ronstrom	2009-10-23
      Upped size limit on varchar/char from 512 to 2048
      modified:
        sql/partition_info.h
        sql/sql_partition.cc
        sql/sql_show.cc

=== modified file 'mysql-test/r/partition_column.result'
--- a/mysql-test/r/partition_column.result	2009-10-22 16:17:59 +0000
+++ b/mysql-test/r/partition_column.result	2009-10-27 23:06:11 +0000
@@ -1,4 +1,14 @@
 drop table if exists t1;
+set @@sql_mode=allow_invalid_dates;
+create table t1 (a char, b char, c date)
+partition by range column_list (a,b,c)
+( partition p0 values less than (0,0,to_days('3000-11-31')));
+ERROR HY000: Partition column values of incorrect type
+create table t1 (a char, b char, c date)
+partition by range column_list (a,b,c)
+( partition p0 values less than (0,0,'3000-11-31'));
+ERROR HY000: Partition column values of incorrect type
+set @@sql_mode='';
 create table t1 (a varchar(2) character set ucs2)
 partition by list column_list (a)
 (partition p0 values in (0x2020),

=== modified file 'mysql-test/t/partition_column.test'
--- a/mysql-test/t/partition_column.test	2009-10-22 16:17:59 +0000
+++ b/mysql-test/t/partition_column.test	2009-10-27 23:06:11 +0000
@@ -9,6 +9,21 @@ drop table if exists t1;
 --enable_warnings
 
 #
+# BUG#48165, sql_mode gives error
+#
+set @@sql_mode=allow_invalid_dates;
+--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
+create table t1 (a char, b char, c date)
+partition by range column_list (a,b,c)
+( partition p0 values less than (0,0,to_days('3000-11-31')));
+
+--error ER_WRONG_TYPE_COLUMN_VALUE_ERROR
+create table t1 (a char, b char, c date)
+partition by range column_list (a,b,c)
+( partition p0 values less than (0,0,'3000-11-31'));
+set @@sql_mode='';
+
+#
 # BUG#48163, Dagger in UCS2 not working as partition value
 #
 create table t1 (a varchar(2) character set ucs2)

=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc	2009-10-22 14:15:06 +0000
+++ b/sql/partition_info.cc	2009-10-27 23:06:11 +0000
@@ -1949,18 +1949,28 @@ bool partition_info::fix_column_value_fu
       {
         uchar *val_ptr;
         uint len= field->pack_length();
+        ulong save_sql_mode;
+        bool save_got_warning;
+
         if (!(column_item= get_column_item(column_item,
                                            field)))
         {
           result= TRUE;
           goto end;
         }
-        if (column_item->save_in_field(field, TRUE))
+        save_sql_mode= thd->variables.sql_mode;
+        thd->variables.sql_mode= 0;
+        save_got_warning= thd->got_warning;
+        thd->got_warning= 0;
+        if (column_item->save_in_field(field, TRUE) ||
+            thd->got_warning)
         {
           my_error(ER_WRONG_TYPE_COLUMN_VALUE_ERROR, MYF(0));
           result= TRUE;
           goto end;
         }
+        thd->got_warning= save_got_warning;
+        thd->variables.sql_mode= save_sql_mode;
         if (!(val_ptr= (uchar*) sql_calloc(len)))
         {
           mem_alloc_error(len);

Thread
bzr push into mysql-5.5.0-trunk branch (mikael:2899 to 2900) Bug#48164Mikael Ronstrom28 Oct