Loading mysql-test/r/partition.result +11 −0 Original line number Diff line number Diff line Loading @@ -546,4 +546,15 @@ t1 CREATE TABLE `t1` ( `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 mysql-test/t/partition.test +17 −0 Original line number Diff line number Diff line Loading @@ -697,4 +697,21 @@ alter table t1 add primary key (b); 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 sql/sql_lex.h +1 −0 Original line number Diff line number Diff line Loading @@ -761,6 +761,7 @@ typedef struct st_lex 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 */ Loading sql/sql_parse.cc +2 −2 Original line number Diff line number Diff line Loading @@ -2897,9 +2897,9 @@ mysql_execute_command(THD *thd) 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, Loading sql/sql_partition.cc +3 −3 Original line number Diff line number Diff line Loading @@ -3741,14 +3741,14 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf, 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]; Loading Loading
mysql-test/r/partition.result +11 −0 Original line number Diff line number Diff line Loading @@ -546,4 +546,15 @@ t1 CREATE TABLE `t1` ( `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
mysql-test/t/partition.test +17 −0 Original line number Diff line number Diff line Loading @@ -697,4 +697,21 @@ alter table t1 add primary key (b); 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
sql/sql_lex.h +1 −0 Original line number Diff line number Diff line Loading @@ -761,6 +761,7 @@ typedef struct st_lex 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 */ Loading
sql/sql_parse.cc +2 −2 Original line number Diff line number Diff line Loading @@ -2897,9 +2897,9 @@ mysql_execute_command(THD *thd) 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, Loading
sql/sql_partition.cc +3 −3 Original line number Diff line number Diff line Loading @@ -3741,14 +3741,14 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf, 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]; Loading