From 1e12f9462b4cbdbafe3ed48a446076979fab38bf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 23 May 2006 07:37:03 -0400 Subject: [PATCH 1/2] BUG#19304: Merge handler allowed in partitioned tables mysql-test/r/partition.result: New test case mysql-test/t/partition.test: New test case sql/partition_info.cc: Check for not merge handler in partitioned table sql/share/errmsg.txt: New error message --- mysql-test/r/partition.result | 4 ++++ mysql-test/t/partition.test | 8 ++++++++ sql/partition_info.cc | 15 ++++++++------- sql/share/errmsg.txt | 3 +++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 0da071374ea..707c5981b2d 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -886,4 +886,8 @@ s1 2 3 drop table t1; +create table t1 (a int) +partition by key (a) +(partition p0 engine = MERGE); +ERROR HY000: MyISAM Merge handler cannot be used in partitioned tables End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 272cdc27af6..1bf4ba9613c 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1009,4 +1009,12 @@ select auto_increment from information_schema.tables where table_name='t1'; select * from t1; drop table t1; +# +# BUG 19304 Partitions: MERGE handler not allowed in partitioned tables +# +--error ER_PARTITION_MERGE_ERROR +create table t1 (a int) +partition by key (a) +(partition p0 engine = MERGE); + --echo End of 5.1 tests diff --git a/sql/partition_info.cc b/sql/partition_info.cc index dfc5dd2989b..83d2a436be3 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -431,18 +431,22 @@ char *partition_info::has_unique_names() bool partition_info::check_engine_mix(handlerton **engine_array, uint no_parts) { uint i= 0; - bool result= FALSE; DBUG_ENTER("partition_info::check_engine_mix"); do { if (engine_array[i] != engine_array[0]) { - result= TRUE; - break; + my_error(ER_MIX_HANDLER_ERROR, MYF(0)); + DBUG_RETURN(TRUE); } } while (++i < no_parts); - DBUG_RETURN(result); + if (!strcmp(engine_array[0]->name,"MRG_MYISAM")) + { + my_error(ER_PARTITION_MERGE_ERROR, MYF(0)); + DBUG_RETURN(TRUE); + } + DBUG_RETURN(FALSE); } @@ -756,10 +760,7 @@ bool partition_info::check_partition_info(handlerton **eng_type, } while (++i < no_parts); } if (unlikely(partition_info::check_engine_mix(engine_array, part_count))) - { - my_error(ER_MIX_HANDLER_ERROR, MYF(0)); goto end; - } if (eng_type) *eng_type= (handlerton*)engine_array[0]; diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 01e66b35c0f..a601300ed5c 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5840,3 +5840,6 @@ ER_NULL_IN_VALUES_LESS_THAN ER_WRONG_PARTITION_NAME eng "Incorrect partition name" swe "Felaktigt partitionsnamn" +ER_PARTITION_MERGE_ERROR + eng "MyISAM Merge handler cannot be used in partitioned tables" + swe "MyISAM Merge kan inte anändas i en partitionerad tabell" From 301c7e0721a7ae1d53fce24706a933d3e5a01e10 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 May 2006 13:35:52 -0400 Subject: [PATCH 2/2] BUG#19304: Merge handler not part of partitioned tables Review fix sql/partition_info.cc: Review fix --- sql/partition_info.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 83d2a436be3..50a3409ef26 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -441,7 +441,7 @@ bool partition_info::check_engine_mix(handlerton **engine_array, uint no_parts) DBUG_RETURN(TRUE); } } while (++i < no_parts); - if (!strcmp(engine_array[0]->name,"MRG_MYISAM")) + if (ha_legacy_type(engine_array[0]) == DB_TYPE_MRG_MYISAM) { my_error(ER_PARTITION_MERGE_ERROR, MYF(0)); DBUG_RETURN(TRUE);