List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:March 20 2012 5:54am
Subject:bzr push into mysql-trunk branch (alexander.barkov:3800 to 3801)
View as plain text  
 3801 Alexander Barkov	2012-03-20 [merge]
      Merging from mysql-5.5

    modified:
      mysql-test/r/ctype_ucs.result
      mysql-test/t/ctype_ucs.test
      sql/field.cc
 3800 Praveenkumar Hulakund	2012-03-19
      BUG#11747847 - 34280: Create table fails if in NO_ZERO_DATE SQL mode.
      
      Analysis:
      -----------------
      The behavior of SQL Modes "NO_ZERO_DATE" and "NO_ZERO_IN_DATE" is as below,
      
          NO_ZERO_DATE:
          ------------
              Strict Mode: Do not permit '0000-00-00' or 0 as valid date
      
              Non-strict Mode: Date '0000-00-00' or 0 is accepted but warning is 
                               generated
          NO_ZERO_IN_DATE:
          ----------------
              Strict Mode: Do not accept the dates where year is non-zero and month
                           or day is 0 (e.g. 2012-00-00)
      
              Non-strict Mode: Date having non-zero year and month or day 0 is 
                               accepted but warning is generated.
      
      
          Strict mode: Setting SQL modes STRICT_ALL_TABLES, STRICT_TRANS_TABLES will
                       enable the strict mode.
      
      CREATE TABLE and ALTER TABLE fails in non-strict mode when NO_ZERO_DATE (NO_ZERO_IN_DATE)
      is set and the default value is zero (contains zero month or day).
      
      INSERT and UPDATE statements work properly.
      
      Fix:
      -----------------
      While inserting/updating, flag "abort_on_warning" of THD is set, if strict SQL
      MODE is set. And if NO_ZERO_DATE or NO_ZERO_IN_DATE mode is also set then for
      zero date or zero in (month/day) of date, error will be generated. But for 
      non-strict mode only warning message is generated as "abort_on_warning" is set
      to "false".
      
      "abort_on_warning" flag of THD decides whether to generate warning or error
      for invalid value in NO_ZERO_DATE or NO_ZERO_IN_DATE SQL modes. 
      
      But "abort_on_warning" was not set for the CREATE TABLE and ALTER TABLE statements.
      
      The fix is to set "abort_on_warning" also for these statements.
     @ include/my_time.h
        To handle errors or warnings when NO_ZERO_IN_DATE is set new name constant
        "MYSQL_TIME_WARN_ZERO_IN_DATE" is added.
     @ mysql-test/r/create.result
        As we are not reporting error when mode is NO_ZERO_DATE in non-strict mode,
        we wont get errors for CREATE and ALTER in these cases of this test.
     @ mysql-test/r/partition_innodb.result
        As we are not reporting error when mode is NO_ZERO_DATE in non-strict mode,
        we wont get error for test.t1 in this test case.
     @ mysql-test/t/create.test
        As we are not reporting error when mode is NO_ZERO_DATE in non-strict mode,
        we wont get errors for CREATE and ALTER in these cases of this test.
     @ sql-common/my_time.c
        We use to return error "MYSQL_TIME_WARN_OUT_OF_RANG", when value is out of 
        range and when 0 is used in day or month of date when NO_ZERO_IN_DATE is set.
        To handle errors or warning for NO_ZERO_IN_DATE, setting warning with new
        name constant "MYSQL_TIME_WARN_ZERO_IN_DATE" added in my_time.h.
     @ sql/field.cc
          change 1: @4750
                    Calling "set_datetime_warning" function if warning 
                    "MYSQL_TIME_WARN_ZERO_IN_DATE" is set.
        
          change 2: @4857
                    Returning value "4" if "MYSQL_TIME_WARN_ZERO_IN_DATE" or
                    "MYSQL_TIME_WARN_ZERO_DATE" is set. Otherwise value "2" is returned.
     @ sql/sql_table.cc
        Setting flag "abort_on_warning" of THD while creating a table in "CREATE" 
        and "ALTER" operations.

    modified:
      include/my_time.h
      mysql-test/r/create.result
      mysql-test/r/partition_innodb.result
      mysql-test/r/type_date.result
      mysql-test/r/type_datetime.result
      mysql-test/r/type_timestamp.result
      mysql-test/t/create.test
      mysql-test/t/type_date.test
      mysql-test/t/type_datetime.test
      mysql-test/t/type_timestamp.test
      sql-common/my_time.c
      sql/field.cc
      sql/item.cc
      sql/item_strfunc.cc
      sql/sp_head.cc
      sql/sql_class.h
      sql/sql_insert.cc
      sql/sql_load.cc
      sql/sql_signal.cc
      sql/sql_table.cc
      sql/sql_update.cc
      sql/unireg.cc
=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result	2012-02-23 16:32:32 +0000
+++ b/mysql-test/r/ctype_ucs.result	2012-03-20 05:51:52 +0000
@@ -4196,6 +4196,17 @@ DROP TABLE t1;
 SET sql_mode=default;
 SET NAMES latin1;
 #
+# Bug #13832953 	MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED
+#
+CREATE TABLE t1 (c1 SET('','') CHARACTER SET ucs2);
+Warnings:
+Note	1291	Column 'c1' has duplicated value '' in SET
+INSERT INTO t1 VALUES ('');
+SELECT COALESCE(c1) FROM t1 ORDER BY 1;
+COALESCE(c1)
+
+DROP TABLE t1;
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/t/ctype_ucs.test'
--- a/mysql-test/t/ctype_ucs.test	2011-03-04 14:59:32 +0000
+++ b/mysql-test/t/ctype_ucs.test	2012-03-20 05:51:52 +0000
@@ -718,6 +718,15 @@ SET collation_connection=ucs2_general_ci
 SET NAMES latin1;
 
 --echo #
+--echo # Bug #13832953 	MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED
+--echo #
+CREATE TABLE t1 (c1 SET('','') CHARACTER SET ucs2);
+INSERT INTO t1 VALUES ('');
+SELECT COALESCE(c1) FROM t1 ORDER BY 1;
+DROP TABLE t1;
+
+
+--echo #
 --echo # End of 5.5 tests
 --echo #
 

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2012-03-19 17:59:14 +0000
+++ b/sql/field.cc	2012-03-20 05:51:52 +0000
@@ -8506,8 +8506,7 @@ String *Field_set::val_str(String *val_b
   ulonglong tmp=(ulonglong) Field_enum::val_int();
   uint bitnr=0;
 
-  val_buffer->length(0);
-  val_buffer->set_charset(field_charset);
+  val_buffer->set("", 0, field_charset);
   while (tmp && bitnr < (uint) typelib->count)
   {
     if (tmp & 1)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alexander.barkov:3800 to 3801) Alexander Barkov20 Mar