From: Date: April 19 2006 3:13pm Subject: bk commit into 5.1 tree (gluh:1.2369) BUG#18730 List-Archive: http://lists.mysql.com/commits/5140 X-Bug: 18730 Message-Id: <20060419131348.A9127528F5F@eagle.intranet.mysql.r18.ru> Below is the list of changes that have just been committed into a local 5.1 repository of gluh. When gluh does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2369 06/04/19 18:13:36 gluh@stripped +3 -0 Fix for bug#18730 Partitions: NDB, crash on SELECT MIN() issue an error if argument of HASH or KEY method is not a part of unique key sql/sql_partition.cc 1.66 06/04/19 18:13:29 gluh@stripped +13 -1 Fix for bug#18730 Partitions: NDB, crash on SELECT MIN() issue an error if argument of HASH or KEY method is not a part of unique key mysql-test/t/ndb_partition_error.test 1.7 06/04/19 18:13:29 gluh@stripped +23 -0 Fix for bug#18730 Partitions: NDB, crash on SELECT MIN() mysql-test/r/ndb_partition_error.result 1.10 06/04/19 18:13:29 gluh@stripped +16 -0 Fix for bug#18730 Partitions: NDB, crash on SELECT MIN() # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: gluh # Host: eagle.intranet.mysql.r18.ru # Root: /home/gluh/MySQL/Bugs/5.1.18730 --- 1.65/sql/sql_partition.cc Mon Apr 10 22:48:52 2006 +++ 1.66/sql/sql_partition.cc Wed Apr 19 18:13:29 2006 @@ -1471,7 +1471,19 @@ bool fix_partition_func(THD *thd, const if (unlikely(check_primary_key(table))) goto end; if (unlikely((!(table->s->db_type->partition_flags && - (table->s->db_type->partition_flags() & HA_CAN_PARTITION_UNIQUE))) && + (table->s->db_type->partition_flags() & + HA_CAN_PARTITION_UNIQUE)) || + /* + Additional check for NDB tables with user defined prtitions. + IF (table has no primary key) and (table has unique key) + and ((partition method is HASH) or + (partition method is KEY and KEY's list of fields exists)) + THEN check unique key. + */ + (!part_info->list_of_part_fields || + part_info->part_field_list.elements) && + part_info->part_type == HASH_PARTITION && + table->s->primary_key == MAX_KEY) && check_unique_keys(table))) goto end; if (unlikely(set_up_partition_bitmap(thd, part_info))) --- 1.9/mysql-test/r/ndb_partition_error.result Tue Mar 7 15:23:15 2006 +++ 1.10/mysql-test/r/ndb_partition_error.result Wed Apr 19 18:13:29 2006 @@ -45,3 +45,19 @@ partition x234 values in (5, 1)); insert into t1 values (NULL,1,1); ERROR HY000: Table has no partition for value NULL drop table t1; +CREATE TABLE t1 (f1 INTEGER, f2 INTEGER, +UNIQUE INDEX(f1)) ENGINE=NDB +PARTITION BY HASH(f2) PARTITIONS 2; +ERROR HY000: A UNIQUE INDEX need to include all fields in the partition function +CREATE TABLE t1 (f1 INTEGER, f2 INTEGER, +primary key(f2), UNIQUE INDEX(f1)) ENGINE=NDB +PARTITION BY HASH(f2) PARTITIONS 2; +drop table t1; +CREATE TABLE t1 (f1 INTEGER, f2 INTEGER, +UNIQUE INDEX(f1)) ENGINE=NDB +PARTITION BY KEY(f2) PARTITIONS 2; +ERROR HY000: A UNIQUE INDEX need to include all fields in the partition function +CREATE TABLE t1 (f1 INTEGER, f2 INTEGER, +primary key(f2), UNIQUE INDEX(f1)) ENGINE=NDB +PARTITION BY key(f2) PARTITIONS 2; +drop table t1; --- 1.6/mysql-test/t/ndb_partition_error.test Tue Mar 14 21:37:23 2006 +++ 1.7/mysql-test/t/ndb_partition_error.test Wed Apr 19 18:13:29 2006 @@ -69,3 +69,26 @@ partitions 2 --error 1505 insert into t1 values (NULL,1,1); drop table t1; + +# +# Bug#18730 Partitions: NDB, crash on SELECT MIN() +# +--error 1482 +CREATE TABLE t1 (f1 INTEGER, f2 INTEGER, +UNIQUE INDEX(f1)) ENGINE=NDB +PARTITION BY HASH(f2) PARTITIONS 2; + +CREATE TABLE t1 (f1 INTEGER, f2 INTEGER, +primary key(f2), UNIQUE INDEX(f1)) ENGINE=NDB +PARTITION BY HASH(f2) PARTITIONS 2; +drop table t1; + +--error 1482 +CREATE TABLE t1 (f1 INTEGER, f2 INTEGER, +UNIQUE INDEX(f1)) ENGINE=NDB +PARTITION BY KEY(f2) PARTITIONS 2; + +CREATE TABLE t1 (f1 INTEGER, f2 INTEGER, +primary key(f2), UNIQUE INDEX(f1)) ENGINE=NDB +PARTITION BY key(f2) PARTITIONS 2; +drop table t1;