List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:July 29 2009 3:56pm
Subject:bzr commit into mysql-5.1-bugteam branch (mikael:3047) Bug#46354
View as plain text  
#At file:///home/mikael/mysql_clones/mysql-5.1-bugteam-bug46354/

 3047 Mikael Ronstrom	2009-07-29
      Bug#46354, when defining partitions without subpartition definition after defining it with the first partition and using list partition caused crash, fixed by more error checks in parser
      modified:
        mysql-test/r/partition.result
        mysql-test/t/partition.test
        sql/sql_yacc.yy

=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2009-07-02 14:42:00 +0000
+++ b/mysql-test/r/partition.result	2009-07-29 15:56:32 +0000
@@ -1068,7 +1068,13 @@ partition by range (a)
 subpartition by hash(a)
 (partition p0 values less than (0),
 partition p1 values less than (1) (subpartition sp0));
-ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '))' at line 5
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'subpartition sp0))' at line 5
+create table t1 (a int, b int)
+partition by list (a)
+subpartition by hash(a)
+(partition p0 values in (0),
+partition p1 values in (1) (subpartition sp0));
+ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'subpartition sp0))' at line 5
 create table t1 (a int)
 partition by hash (a)
 (partition p0 (subpartition sp0));

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2009-07-02 14:42:00 +0000
+++ b/mysql-test/t/partition.test	2009-07-29 15:56:32 +0000
@@ -1020,6 +1020,17 @@ subpartition by hash(a)
  partition p1 values less than (1) (subpartition sp0));
 
 #
+# Bug 46354 Crash with subpartition
+#
+--error ER_PARSE_ERROR
+create table t1 (a int, b int)
+partition by list (a)
+subpartition by hash(a)
+(partition p0 values in (0),
+ partition p1 values in (1) (subpartition sp0));
+
+
+#
 # BUG 15961 No error when subpartition defined without subpartition by clause
 #
 --error ER_SUBPARTITION_ERROR

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2009-07-29 08:54:20 +0000
+++ b/sql/sql_yacc.yy	2009-07-29 15:56:32 +0000
@@ -4206,6 +4206,10 @@ opt_sub_partition:
             if (Lex->part_info->no_subparts != 0 &&
                 !Lex->part_info->use_default_subpartitions)
             {
+              /*
+                We come here when we have defined subpartitions on the first
+                partition but not on all the subsequent partitions. 
+              */
               my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
               MYSQL_YYABORT;
             }
@@ -4248,6 +4252,23 @@ sub_part_definition:
             partition_info *part_info= lex->part_info;
             partition_element *curr_part= part_info->current_partition;
             partition_element *sub_p_elem= new partition_element(curr_part);
+            if (part_info->use_default_subpartitions &&
+                part_info->partitions.elements >= 2)
+            {
+              /*
+                create table t1 (a int)
+                partition by list (a) subpartition by hash (a)
+                (partition p0 values in (1),
+                 partition p1 values in (2) subpartition sp11);
+                causes use to arrive since we are on the second
+                partition, but still use_default_subpartitions
+                is set. When we come here we're processing at least
+                the second partition (the current partition processed
+                have already been put into the partitions list.
+              */
+              my_parse_error(ER(ER_PARTITION_WRONG_NO_SUBPART_ERROR));
+              MYSQL_YYABORT;
+            }
             if (!sub_p_elem ||
              curr_part->subpartitions.push_back(sub_p_elem))
             {

Thread
bzr commit into mysql-5.1-bugteam branch (mikael:3047) Bug#46354Mikael Ronstrom29 Jul