List:Internals« Previous MessageNext Message »
From:gluh Date:September 23 2005 9:33am
Subject:bk commit into 4.1 tree (gluh:1.2458) BUG#7977
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of gluh. When gluh 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.2458 05/09/23 14:33:50 gluh@stripped +3 -0
  Fix for bug #7977 in sql_mode=ANSI, show create table ignores auto_increment
   "CHARACTER SET", "COLLATE", and "DEFAULT" are always
   printed(excepting MODE_MYSQL323 and MODE_MYSQL40)
   "AUTO_INCREMENT", "ON UPDATE CURRENT_TIMESTAMP" are printed only 
   if NO_FIELD_OPTIONS is not set.

  sql/sql_show.cc
    1.204 05/09/23 14:33:46 gluh@stripped +6 -4
    Fix for bug #7977 in sql_mode=ANSI, show create table ignores auto_increment
     "CHARACTER SET", "COLLATE", and "DEFAULT" are always
     printed(excepting MODE_MYSQL323 and MODE_MYSQL40)
     "AUTO_INCREMENT", "ON UPDATE CURRENT_TIMESTAMP" are printed only 
     if NO_FIELD_OPTIONS is not set.

  mysql-test/t/sql_mode.test
    1.10 05/09/23 14:33:46 gluh@stripped +12 -0
    Fix for bug #7977 in sql_mode=ANSI, show create table ignores auto_increment
     test case

  mysql-test/r/sql_mode.result
    1.13 05/09/23 14:33:46 gluh@stripped +23 -3
    Fix for bug #7977 in sql_mode=ANSI, show create table ignores auto_increment
     test case

# 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:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Bugs/4.1.7977

--- 1.203/sql/sql_show.cc	Wed Sep 14 16:18:11 2005
+++ 1.204/sql/sql_show.cc	Fri Sep 23 14:33:46 2005
@@ -1299,7 +1299,8 @@
     field->sql_type(type);
     packet->append(type.ptr(), type.length(), system_charset_info);
 
-    if (field->has_charset() && !limited_mysql_mode && !foreign_db_mode)
+    if (field->has_charset() && 
+        !(thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)))
     {
       if (field->charset() != table->table_charset)
       {
@@ -1337,7 +1338,7 @@
     
     has_default= (field->type() != FIELD_TYPE_BLOB &&
 		  field->unireg_check != Field::NEXT_NUMBER &&
-                  !((foreign_db_mode || limited_mysql_mode) &&
+                  !((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) &&
                     has_now_default));
 
     if (has_default)
@@ -1367,12 +1368,13 @@
         packet->append(tmp);
     }
 
-    if (!foreign_db_mode && !limited_mysql_mode &&
+    if (!(thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS) &&
         table->timestamp_field == field && 
         field->unireg_check != Field::TIMESTAMP_DN_FIELD)
       packet->append(" on update CURRENT_TIMESTAMP",28);
 
-    if (field->unireg_check == Field::NEXT_NUMBER && !foreign_db_mode)
+    if (field->unireg_check == Field::NEXT_NUMBER && 
+        !(thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS))
       packet->append(" auto_increment", 15 );
 
     if (field->comment.length)

--- 1.12/mysql-test/r/sql_mode.result	Thu Jul  7 17:43:31 2005
+++ 1.13/mysql-test/r/sql_mode.result	Fri Sep 23 14:33:46 2005
@@ -65,7 +65,7 @@
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `a` int(11) NOT NULL auto_increment,
+  `a` int(11) NOT NULL,
   `pseudo` varchar(35) NOT NULL default '',
   `email` varchar(60) NOT NULL default '',
   PRIMARY KEY  (`a`),
@@ -79,8 +79,8 @@
 Table	Create Table
 t1	CREATE TABLE "t1" (
   "a" int(11) NOT NULL,
-  "pseudo" varchar(35) NOT NULL default '',
-  "email" varchar(60) NOT NULL default '',
+  "pseudo" varchar(35) character set latin2 NOT NULL default '',
+  "email" varchar(60) character set latin2 NOT NULL default '',
   PRIMARY KEY  ("a"),
   UNIQUE KEY "email" ("email")
 )
@@ -140,3 +140,23 @@
 drop table t1 ;
 set @@SQL_MODE=NULL;
 ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
+set session sql_mode=ansi;
+create table t1
+(f1 integer auto_increment primary key,
+f2 timestamp default current_timestamp on update current_timestamp);
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE "t1" (
+  "f1" int(11) NOT NULL auto_increment,
+  "f2" timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+  PRIMARY KEY  ("f1")
+)
+set session sql_mode=no_field_options;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `f1` int(11) NOT NULL,
+  `f2` timestamp NOT NULL default CURRENT_TIMESTAMP,
+  PRIMARY KEY  (`f1`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;

--- 1.9/mysql-test/t/sql_mode.test	Thu Jul 28 05:21:49 2005
+++ 1.10/mysql-test/t/sql_mode.test	Fri Sep 23 14:33:46 2005
@@ -86,4 +86,16 @@
 --error 1231
 set @@SQL_MODE=NULL;
 
+#
+# Bug #797: in sql_mode=ANSI, show create table ignores auto_increment
+#
+set session sql_mode=ansi;
+create table t1
+(f1 integer auto_increment primary key,
+ f2 timestamp default current_timestamp on update current_timestamp);
+show create table t1;
+set session sql_mode=no_field_options;
+show create table t1;
+drop table t1;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (gluh:1.2458) BUG#7977gluh23 Sep