Commit a3170bf6 authored by unknown's avatar unknown
Browse files

BUG#19695: Showed partition options when table options were not shown


mysql-test/r/ndb_partition_key.result:
  Manicural changes removed a space from a double-space
mysql-test/r/partition.result:
  Manicural changes removed a space from a double-space
  Added new test case
mysql-test/r/partition_02myisam.result:
  Manicural changes removed a space from a double-space
mysql-test/r/partition_range.result:
  Manicural changes removed a space from a double-space
mysql-test/t/partition.test:
  New test case
sql/sql_partition.cc:
  Removed unnecessary extra spaces
  Added show_partition_options set in the same way as when to show table options in SHOW CREATE TABLE
sql/sql_partition.h:
  Removed unnecessary extra spaces
  Added show_partition_options set in the same way as when to show table options in SHOW CREATE TABLE
sql/sql_show.cc:
  Removed unnecessary extra spaces
  Added show_partition_options set in the same way as when to show table options in SHOW CREATE TABLE
sql/sql_table.cc:
  Removed unnecessary extra spaces
  Added show_partition_options set in the same way as when to show table options in SHOW CREATE TABLE
parent 19b40124
Loading
Loading
Loading
Loading
+24 −13
Original line number Diff line number Diff line
@@ -886,4 +886,15 @@ 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;
End of 5.1 tests
+12 −0
Original line number Diff line number Diff line
@@ -1009,4 +1009,16 @@ select auto_increment from information_schema.tables where table_name='t1';
select * from t1;
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;

--echo End of 5.1 tests
+10 −8
Original line number Diff line number Diff line
@@ -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);
@@ -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;
}

/*
@@ -1755,6 +1756,7 @@ static int add_partition_values(File fptr, partition_info *part_info,
    use_sql_alloc              Allocate buffer from sql_alloc if true
                               otherwise use my_malloc
    write_all                  Write everything, also default values
    show_partition_options     Should we display partition options

  RETURN VALUES
    NULL error
@@ -1783,7 +1785,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 write_all)
                                bool write_all,
                                bool show_partition_options)
{
  uint i,j, tot_no_parts, no_subparts, no_parts;
  partition_element *part_elem;
@@ -1882,9 +1885,8 @@ 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())
        if (!part_info->is_sub_partitioned() && show_partition_options)
          err+= add_partition_options(fptr, part_elem);
        if (part_info->is_sub_partitioned() &&
            (write_all || (!part_info->use_default_subpartitions)))
@@ -1898,7 +1900,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))
            {
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ 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,
                                bool write_all);
                                bool write_all, 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,
+4 −1
Original line number Diff line number Diff line
@@ -932,6 +932,7 @@ 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 |
@@ -1149,6 +1150,7 @@ 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
@@ -1288,7 +1290,8 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
    if (table->part_info &&
        ((part_syntax= generate_partition_syntax(table->part_info,
                                                  &part_syntax_len,
                                                  FALSE,FALSE))))
                                                  FALSE,FALSE,
                                                  show_table_options))))
    {
       packet->append(part_syntax, part_syntax_len);
       my_free(part_syntax, MYF(0));
Loading