From de3e0fcb924b8f403b93bd6ebbff1166ad79ec8b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Dec 2005 15:24:35 +0400 Subject: bug #15521 (Cannot reorganise a partition with a new name equal to the old name) mysql-test/r/partition.result: result fixed mysql-test/r/partition_mgm_err.result: result fixed mysql-test/t/partition.test: test case added mysql-test/t/partition_mgm_err.test: test modified to produce the declared error sql/handler.h: check_reorganise_list interface sql/sql_partition.cc: check_reorganise_list implementation sql/sql_table.cc: now we call check_reorganise_list to do proper test. Also we should set right no_parts value as it can change here --- mysql-test/r/partition.result | 34 ++++++++++++++++++++++++++++++++++ mysql-test/r/partition_mgm_err.result | 2 +- mysql-test/t/partition.test | 31 +++++++++++++++++++++++++++++++ mysql-test/t/partition_mgm_err.test | 2 +- 4 files changed, 67 insertions(+), 2 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index f0500c639a3..58f02681682 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -114,3 +114,37 @@ CREATE TABLE `t1` ( SELECT * FROM t1; id drop table t1; +create table t1 +(a int) +partition by range (a) +( partition p0 values less than(10), +partition p1 values less than (20), +partition p2 values less than maxvalue); +alter table t1 reorganise partition p2 into (partition p2 values less than (30)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM) +drop table t1; +CREATE TABLE t1 (a int, b int) +PARTITION BY RANGE (a) +(PARTITION x0 VALUES LESS THAN (2), +PARTITION x1 VALUES LESS THAN (4), +PARTITION x2 VALUES LESS THAN (6), +PARTITION x3 VALUES LESS THAN (8), +PARTITION x4 VALUES LESS THAN (10), +PARTITION x5 VALUES LESS THAN (12), +PARTITION x6 VALUES LESS THAN (14), +PARTITION x7 VALUES LESS THAN (16), +PARTITION x8 VALUES LESS THAN (18), +PARTITION x9 VALUES LESS THAN (20)); +ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO +(PARTITION x1 VALUES LESS THAN (6)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) default NULL, + `b` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (a) (PARTITION x1 VALUES LESS THAN (6) ENGINE = MyISAM, PARTITION x3 VALUES LESS THAN (8) ENGINE = MyISAM, PARTITION x4 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION x5 VALUES LESS THAN (12) ENGINE = MyISAM, PARTITION x6 VALUES LESS THAN (14) ENGINE = MyISAM, PARTITION x7 VALUES LESS THAN (16) ENGINE = MyISAM, PARTITION x8 VALUES LESS THAN (18) ENGINE = MyISAM, PARTITION x9 VALUES LESS THAN (20) ENGINE = MyISAM) +drop table t1; diff --git a/mysql-test/r/partition_mgm_err.result b/mysql-test/r/partition_mgm_err.result index ca56dc44666..01709e726bd 100644 --- a/mysql-test/r/partition_mgm_err.result +++ b/mysql-test/r/partition_mgm_err.result @@ -26,7 +26,7 @@ ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO (PARTITION x11 VALUES LESS THAN (22)); ERROR HY000: More partitions to reorganise than there are partitions ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO -(PARTITION x1 VALUES LESS THAN (6)); +(PARTITION x3 VALUES LESS THAN (6)); ERROR HY000: All partitions must have unique names in the table ALTER TABLE t1 REORGANISE PARTITION x0, x2 INTO (PARTITION x11 VALUES LESS THAN (2)); diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 8f20f7be536..8b1c3f58071 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -172,3 +172,34 @@ SELECT * FROM t1; drop table t1; +# +# BUG 15221 (Cannot reorganize with the same name) +# +create table t1 +(a int) +partition by range (a) + ( partition p0 values less than(10), + partition p1 values less than (20), + partition p2 values less than maxvalue); + +alter table t1 reorganise partition p2 into (partition p2 values less than (30)); +show create table t1; +drop table t1; + +CREATE TABLE t1 (a int, b int) +PARTITION BY RANGE (a) +(PARTITION x0 VALUES LESS THAN (2), + PARTITION x1 VALUES LESS THAN (4), + PARTITION x2 VALUES LESS THAN (6), + PARTITION x3 VALUES LESS THAN (8), + PARTITION x4 VALUES LESS THAN (10), + PARTITION x5 VALUES LESS THAN (12), + PARTITION x6 VALUES LESS THAN (14), + PARTITION x7 VALUES LESS THAN (16), + PARTITION x8 VALUES LESS THAN (18), + PARTITION x9 VALUES LESS THAN (20)); + +ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO +(PARTITION x1 VALUES LESS THAN (6)); +show create table t1; +drop table t1; diff --git a/mysql-test/t/partition_mgm_err.test b/mysql-test/t/partition_mgm_err.test index 1d9d8a79f3d..92848fc135e 100644 --- a/mysql-test/t/partition_mgm_err.test +++ b/mysql-test/t/partition_mgm_err.test @@ -43,7 +43,7 @@ ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO --error ER_SAME_NAME_PARTITION ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO -(PARTITION x1 VALUES LESS THAN (6)); +(PARTITION x3 VALUES LESS THAN (6)); --error ER_CONSECUTIVE_REORG_PARTITIONS ALTER TABLE t1 REORGANISE PARTITION x0, x2 INTO -- cgit v1.2.1