List:Commits« Previous MessageNext Message »
From:Mikael Date:March 16 2006 11:21am
Subject:bk commit into 5.1 tree (mikael:1.2189) BUG#17772
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mikael. When mikael 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.2189 06/03/16 03:21:15 mikael@zim.(none) +6 -0
  BUG#17772
  A crash after ALTER TABLE t1 RENAME ...

  sql/sql_yacc.yy
    1.481 06/03/16 03:21:08 mikael@zim.(none) +7 -5
    Introduced like name for CREATE TABLE t1 LIKE t2

  sql/sql_partition.cc
    1.50 06/03/16 03:21:08 mikael@zim.(none) +3 -3
    Introduced like name for CREATE TABLE t1 LIKE t2

  sql/sql_parse.cc
    1.529 06/03/16 03:21:08 mikael@zim.(none) +2 -2
    Introduced like name for CREATE TABLE t1 LIKE t2

  sql/sql_lex.h
    1.222 06/03/16 03:21:08 mikael@zim.(none) +1 -0
    Introduced like name for CREATE TABLE t1 LIKE t2

  mysql-test/t/partition.test
    1.27 06/03/16 03:21:08 mikael@zim.(none) +17 -0
    New test case

  mysql-test/r/partition.result
    1.24 06/03/16 03:21:08 mikael@zim.(none) +11 -0
    New 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:	mikael
# Host:	zim.(none)
# Root:	/home/mikael/bug17772

--- 1.221/sql/sql_lex.h	2006-03-13 06:34:16 -08:00
+++ 1.222/sql/sql_lex.h	2006-03-16 03:21:08 -08:00
@@ -761,6 +761,7 @@
   const uchar *tok_start_prev, *tok_end_prev;
 
   char *length,*dec,*change,*name;
+  Table_ident *like_name;
   char *help_arg;
   char *backup_dir;				/* For RESTORE/BACKUP */
   char* to_log;                                 /* For PURGE MASTER LOGS TO */

--- 1.528/sql/sql_parse.cc	2006-03-13 06:34:16 -08:00
+++ 1.529/sql/sql_parse.cc	2006-03-16 03:21:08 -08:00
@@ -2897,9 +2897,9 @@
     else
     {
       /* regular create */
-      if (lex->name)
+      if (lex->like_name)
         res= mysql_create_like_table(thd, create_table, &lex->create_info, 
-                                     (Table_ident *)lex->name); 
+                                     lex->like_name); 
       else
       {
         res= mysql_create_table(thd, create_table->db,

--- 1.480/sql/sql_yacc.yy	2006-03-14 02:40:55 -08:00
+++ 1.481/sql/sql_yacc.yy	2006-03-16 03:21:08 -08:00
@@ -1214,7 +1214,8 @@
 	  lex->create_info.options=$2 | $4;
 	  lex->create_info.db_type= lex->thd->variables.table_type;
 	  lex->create_info.default_table_charset= NULL;
-	  lex->name=0;
+	  lex->name= 0;
+         lex->like_name= 0;
 	}
 	create2
 	  { Lex->current_select= &Lex->select_lex; }
@@ -3272,13 +3273,13 @@
         | LIKE table_ident
           {
             LEX *lex=Lex;
-            if (!(lex->name= (char *)$2))
+            if (!(lex->like_name= $2))
               YYABORT;
           }
         | '(' LIKE table_ident ')'
           {
             LEX *lex=Lex;
-            if (!(lex->name= (char *)$3))
+            if (!(lex->like_name= $3))
               YYABORT;
           }
         ;
@@ -4712,8 +4713,8 @@
 	{
 	  THD *thd= YYTHD;
 	  LEX *lex= thd->lex;
+         lex->name= 0;
 	  lex->sql_command= SQLCOM_ALTER_TABLE;
-	  lex->name= 0;
 	  lex->duplicates= DUP_ERROR; 
 	  if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
 						 TL_OPTION_UPDATING))
@@ -4722,7 +4723,8 @@
 	  lex->key_list.empty();
 	  lex->col_list.empty();
           lex->select_lex.init_order();
-	  lex->select_lex.db=lex->name=0;
+	  lex->select_lex.db=lex->name= 0;
+         lex->like_name= 0;
 	  bzero((char*) &lex->create_info,sizeof(lex->create_info));
 	  lex->create_info.db_type= (handlerton*) &default_hton;
 	  lex->create_info.default_table_charset= NULL;

--- 1.23/mysql-test/r/partition.result	2006-03-14 03:46:06 -08:00
+++ 1.24/mysql-test/r/partition.result	2006-03-16 03:21:08 -08:00
@@ -546,4 +546,15 @@
   `b` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION p1 VALUES IN (1) ENGINE = MyISAM, PARTITION p2 VALUES IN (2) ENGINE = MyISAM)
 drop table t1;
+create table t1 (a int unsigned not null auto_increment primary key)
+partition by key(a);
+alter table t1 rename t2, add c char(10), comment "no comment";
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `a` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `c` char(10) DEFAULT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='no comment' PARTITION BY KEY (a) 
+drop table t2;
 End of 5.1 tests

--- 1.26/mysql-test/t/partition.test	2006-03-14 03:46:06 -08:00
+++ 1.27/mysql-test/t/partition.test	2006-03-16 03:21:08 -08:00
@@ -697,4 +697,21 @@
 show create table t1;
 drop table t1;
 
+############################################
+#
+# Author: Mikael Ronstrom
+# Date:   2006-03-01
+# Purpose
+# Bug 17772: Crash at ALTER TABLE with rename
+#            and add column + comment on
+#            partitioned table
+#
+############################################
+create table t1 (a int unsigned not null auto_increment primary key)
+partition by key(a);
+alter table t1 rename t2, add c char(10), comment "no comment";
+show create table t2;
+
+drop table t2;
+
 --echo End of 5.1 tests

--- 1.49/sql/sql_partition.cc	2006-03-14 03:46:06 -08:00
+++ 1.50/sql/sql_partition.cc	2006-03-16 03:21:08 -08:00
@@ -3741,14 +3741,14 @@
              ha_legacy_type(default_db_type)));
   if (is_create_table_ind)
   {
-    if (old_lex->name)
+    if (old_lex->like_name)
     {
       /*
         This code is executed when we do a CREATE TABLE t1 LIKE t2
-        old_lex->name contains the t2 and the table we are opening has 
+        old_lex->like_name contains the t2 and the table we are opening has 
         name t1.
       */
-      Table_ident *table_ident= (Table_ident *)old_lex->name;
+      Table_ident *table_ident= old_lex->like_name;
       char *src_db= table_ident->db.str ? table_ident->db.str : thd->db;
       char *src_table= table_ident->table.str;
       char buf[FN_REFLEN];
Thread
bk commit into 5.1 tree (mikael:1.2189) BUG#17772Mikael16 Mar