MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:November 9 2009 10:26am
Subject:bzr commit into mysql-5.1-bugteam branch (mattias.jonsson:3202)
Bug#48276
View as plain text  
#At file:///Users/mattiasj/clones/bzrroot/b48276-51-bugteam/ based on revid:epotemkin@stripped

 3202 Mattias Jonsson	2009-11-09
      Bug#48276: can't add column if subpartition exists
      
      Bug when setting up default partitioning,
      used an uninitialized variabe.
     @ mysql-test/r/partition.result
        Bug#48276: can't add column if subpartition exists
        
        Added result
     @ mysql-test/t/partition.test
        Bug#48276: can't add column if subpartition exists
        
        Added test
     @ sql/sql_partition.cc
        Bug#48276: can't add column if subpartition exists
        
        even if is_create_table_ind was set, one tried to set no_subparts
        with the unitialized no_parts local variable.
        
        Fixed by rearrange the code to be to only execute
        the statements when is_create_table_ind was not set.

    modified:
      mysql-test/r/partition.result
      mysql-test/t/partition.test
      sql/sql_partition.cc
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2009-10-08 13:58:17 +0000
+++ b/mysql-test/r/partition.result	2009-11-09 10:26:01 +0000
@@ -1,4 +1,10 @@
 drop table if exists t1, t2;
+CREATE TABLE t1 (a INT, b INT)
+PARTITION BY LIST (a)
+SUBPARTITION BY HASH (b)
+(PARTITION p1 VALUES IN (1));
+ALTER TABLE t1 ADD COLUMN c INT;
+DROP TABLE t1;
 CREATE TABLE t1 (
 a int NOT NULL,
 b int NOT NULL);

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2009-10-08 13:58:17 +0000
+++ b/mysql-test/t/partition.test	2009-11-09 10:26:01 +0000
@@ -15,6 +15,15 @@ drop table if exists t1, t2;
 --enable_warnings
 
 #
+# Bug#48276: can't add column if subpartition exists
+CREATE TABLE t1 (a INT, b INT)
+PARTITION BY LIST (a)
+SUBPARTITION BY HASH (b)
+(PARTITION p1 VALUES IN (1));
+ALTER TABLE t1 ADD COLUMN c INT;
+DROP TABLE t1;
+
+#
 # Bug#46639: 1030 (HY000): Got error 124 from storage engine on
 # INSERT ... SELECT ...
 CREATE TABLE t1 (

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2009-10-16 10:29:42 +0000
+++ b/sql/sql_partition.cc	2009-11-09 10:26:01 +0000
@@ -196,26 +196,27 @@ bool partition_default_handling(TABLE *t
 {
   DBUG_ENTER("partition_default_handling");
 
-  if (part_info->use_default_no_partitions)
+  if (!is_create_table_ind)
   {
-    if (!is_create_table_ind &&
-        table->file->get_no_parts(normalized_path, &part_info->no_parts))
+    if (part_info->use_default_no_partitions)
     {
-      DBUG_RETURN(TRUE);
+      if (table->file->get_no_parts(normalized_path, &part_info->no_parts))
+      {
+        DBUG_RETURN(TRUE);
+      }
     }
-  }
-  else if (part_info->is_sub_partitioned() &&
-           part_info->use_default_no_subpartitions)
-  {
-    uint no_parts;
-    if (!is_create_table_ind &&
-        (table->file->get_no_parts(normalized_path, &no_parts)))
+    else if (part_info->is_sub_partitioned() &&
+             part_info->use_default_no_subpartitions)
     {
-      DBUG_RETURN(TRUE);
+      uint no_parts;
+      if (table->file->get_no_parts(normalized_path, &no_parts))
+      {
+        DBUG_RETURN(TRUE);
+      }
+      DBUG_ASSERT(part_info->no_parts > 0);
+      DBUG_ASSERT((no_parts % part_info->no_parts) == 0);
+      part_info->no_subparts= no_parts / part_info->no_parts;
     }
-    DBUG_ASSERT(part_info->no_parts > 0);
-    part_info->no_subparts= no_parts / part_info->no_parts;
-    DBUG_ASSERT((no_parts % part_info->no_parts) == 0);
   }
   part_info->set_up_defaults_for_partitioning(table->file,
                                               (ulonglong)0, (uint)0);


Attachment: [text/bzr-bundle]
Thread
bzr commit into mysql-5.1-bugteam branch (mattias.jonsson:3202)Bug#48276Mattias Jonsson9 Nov