Loading mysql-test/r/partition.result +23 −12 Original line number Diff line number Diff line Loading @@ -907,6 +907,17 @@ s1 2 3 drop table t1; create table t1 (a int) PARTITION BY KEY (a) (PARTITION p0); set session sql_mode='no_table_options'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) PARTITION BY KEY (a) (PARTITION p0) set session sql_mode=''; drop table t1; create table t1 (a int) engine=memory partition by key(a); insert into t1 values (1); Loading mysql-test/t/partition.test +12 −0 Original line number Diff line number Diff line Loading @@ -1036,6 +1036,18 @@ insert into t1 values (1); create index inx1 on t1(a); drop table t1; # # Bug 19695 Partitions: SHOW CREATE TABLE shows table options even when it # shouldn't # create table t1 (a int) PARTITION BY KEY (a) (PARTITION p0); set session sql_mode='no_table_options'; show create table t1; set session sql_mode=''; drop table t1; # # BUG 19304 Partitions: MERGE handler not allowed in partitioned tables # Loading sql/sql_partition.cc +11 −8 Original line number Diff line number Diff line Loading @@ -1675,6 +1675,7 @@ static int add_partition_options(File fptr, partition_element *p_elem) { int err= 0; err+= add_space(fptr); if (p_elem->tablespace_name) err+= add_keyword_string(fptr,"TABLESPACE", FALSE, p_elem->tablespace_name); Loading Loading @@ -1740,7 +1741,7 @@ static int add_partition_values(File fptr, partition_info *part_info, err+= add_end_parenthesis(fptr); } end: return err + add_space(fptr); return err; } /* Loading @@ -1754,6 +1755,7 @@ static int add_partition_values(File fptr, partition_info *part_info, buf_length A pointer to the returned buffer length use_sql_alloc Allocate buffer from sql_alloc if true otherwise use my_malloc show_partition_options Should we display partition options RETURN VALUES NULL error Loading Loading @@ -1781,7 +1783,8 @@ static int add_partition_values(File fptr, partition_info *part_info, char *generate_partition_syntax(partition_info *part_info, uint *buf_length, bool use_sql_alloc) bool use_sql_alloc, bool show_partition_options) { uint i,j, tot_no_parts, no_subparts, no_parts; partition_element *part_elem; Loading Loading @@ -1882,11 +1885,11 @@ char *generate_partition_syntax(partition_info *part_info, first= FALSE; err+= add_partition(fptr); err+= add_name_string(fptr, part_elem->partition_name); err+= add_space(fptr); err+= add_partition_values(fptr, part_info, part_elem); if (!part_info->is_sub_partitioned() || part_info->use_default_subpartitions) { if (show_partition_options) err+= add_partition_options(fptr, part_elem); } else Loading @@ -1900,7 +1903,7 @@ char *generate_partition_syntax(partition_info *part_info, part_elem= sub_it++; err+= add_subpartition(fptr); err+= add_name_string(fptr, part_elem->partition_name); err+= add_space(fptr); if (show_partition_options) err+= add_partition_options(fptr, part_elem); if (j != (no_subparts-1)) { Loading sql/sql_partition.h +2 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,8 @@ bool check_partition_info(partition_info *part_info,handlerton **eng_type, bool fix_partition_func(THD *thd, const char *name, TABLE *table, bool create_table_ind); char *generate_partition_syntax(partition_info *part_info, uint *buf_length, bool use_sql_alloc); uint *buf_length, bool use_sql_alloc, bool show_partition_options); bool partition_key_modified(TABLE *table, List<Item> &fields); void get_partition_set(const TABLE *table, byte *buf, const uint index, const key_range *key_spec, Loading sql/sql_show.cc +4 −1 Original line number Diff line number Diff line Loading @@ -970,6 +970,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, handler *file= table->file; TABLE_SHARE *share= table->s; HA_CREATE_INFO create_info; bool show_table_options= FALSE; bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL | MODE_ORACLE | MODE_MSSQL | Loading Loading @@ -1195,6 +1196,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, packet->append(STRING_WITH_LEN("\n)")); if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode) { show_table_options= TRUE; /* Get possible table space definitions and append them to the CREATE TABLE statement Loading Loading @@ -1335,7 +1337,8 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, (!table->part_info->is_auto_partitioned) && ((part_syntax= generate_partition_syntax(table->part_info, &part_syntax_len, FALSE)))) FALSE, show_table_options)))) { packet->append(part_syntax, part_syntax_len); my_free(part_syntax, MYF(0)); Loading Loading
mysql-test/r/partition.result +23 −12 Original line number Diff line number Diff line Loading @@ -907,6 +907,17 @@ s1 2 3 drop table t1; create table t1 (a int) PARTITION BY KEY (a) (PARTITION p0); set session sql_mode='no_table_options'; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) PARTITION BY KEY (a) (PARTITION p0) set session sql_mode=''; drop table t1; create table t1 (a int) engine=memory partition by key(a); insert into t1 values (1); Loading
mysql-test/t/partition.test +12 −0 Original line number Diff line number Diff line Loading @@ -1036,6 +1036,18 @@ insert into t1 values (1); create index inx1 on t1(a); drop table t1; # # Bug 19695 Partitions: SHOW CREATE TABLE shows table options even when it # shouldn't # create table t1 (a int) PARTITION BY KEY (a) (PARTITION p0); set session sql_mode='no_table_options'; show create table t1; set session sql_mode=''; drop table t1; # # BUG 19304 Partitions: MERGE handler not allowed in partitioned tables # Loading
sql/sql_partition.cc +11 −8 Original line number Diff line number Diff line Loading @@ -1675,6 +1675,7 @@ static int add_partition_options(File fptr, partition_element *p_elem) { int err= 0; err+= add_space(fptr); if (p_elem->tablespace_name) err+= add_keyword_string(fptr,"TABLESPACE", FALSE, p_elem->tablespace_name); Loading Loading @@ -1740,7 +1741,7 @@ static int add_partition_values(File fptr, partition_info *part_info, err+= add_end_parenthesis(fptr); } end: return err + add_space(fptr); return err; } /* Loading @@ -1754,6 +1755,7 @@ static int add_partition_values(File fptr, partition_info *part_info, buf_length A pointer to the returned buffer length use_sql_alloc Allocate buffer from sql_alloc if true otherwise use my_malloc show_partition_options Should we display partition options RETURN VALUES NULL error Loading Loading @@ -1781,7 +1783,8 @@ static int add_partition_values(File fptr, partition_info *part_info, char *generate_partition_syntax(partition_info *part_info, uint *buf_length, bool use_sql_alloc) bool use_sql_alloc, bool show_partition_options) { uint i,j, tot_no_parts, no_subparts, no_parts; partition_element *part_elem; Loading Loading @@ -1882,11 +1885,11 @@ char *generate_partition_syntax(partition_info *part_info, first= FALSE; err+= add_partition(fptr); err+= add_name_string(fptr, part_elem->partition_name); err+= add_space(fptr); err+= add_partition_values(fptr, part_info, part_elem); if (!part_info->is_sub_partitioned() || part_info->use_default_subpartitions) { if (show_partition_options) err+= add_partition_options(fptr, part_elem); } else Loading @@ -1900,7 +1903,7 @@ char *generate_partition_syntax(partition_info *part_info, part_elem= sub_it++; err+= add_subpartition(fptr); err+= add_name_string(fptr, part_elem->partition_name); err+= add_space(fptr); if (show_partition_options) err+= add_partition_options(fptr, part_elem); if (j != (no_subparts-1)) { Loading
sql/sql_partition.h +2 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,8 @@ bool check_partition_info(partition_info *part_info,handlerton **eng_type, bool fix_partition_func(THD *thd, const char *name, TABLE *table, bool create_table_ind); char *generate_partition_syntax(partition_info *part_info, uint *buf_length, bool use_sql_alloc); uint *buf_length, bool use_sql_alloc, bool show_partition_options); bool partition_key_modified(TABLE *table, List<Item> &fields); void get_partition_set(const TABLE *table, byte *buf, const uint index, const key_range *key_spec, Loading
sql/sql_show.cc +4 −1 Original line number Diff line number Diff line Loading @@ -970,6 +970,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, handler *file= table->file; TABLE_SHARE *share= table->s; HA_CREATE_INFO create_info; bool show_table_options= FALSE; bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL | MODE_ORACLE | MODE_MSSQL | Loading Loading @@ -1195,6 +1196,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, packet->append(STRING_WITH_LEN("\n)")); if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode) { show_table_options= TRUE; /* Get possible table space definitions and append them to the CREATE TABLE statement Loading Loading @@ -1335,7 +1337,8 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, (!table->part_info->is_auto_partitioned) && ((part_syntax= generate_partition_syntax(table->part_info, &part_syntax_len, FALSE)))) FALSE, show_table_options)))) { packet->append(part_syntax, part_syntax_len); my_free(part_syntax, MYF(0)); Loading