summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <holyfoot@deer.(none)>2005-12-15 15:24:35 +0400
committerunknown <holyfoot@deer.(none)>2005-12-15 15:24:35 +0400
commitde3e0fcb924b8f403b93bd6ebbff1166ad79ec8b (patch)
tree945b17176ab5d62b6024f9dfd9e6c8535a87679d /mysql-test
parent472ad40d561f5e6fdec00e81abaf7474e4b6fc68 (diff)
downloadmariadb-git-de3e0fcb924b8f403b93bd6ebbff1166ad79ec8b.tar.gz
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
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/partition.result34
-rw-r--r--mysql-test/r/partition_mgm_err.result2
-rw-r--r--mysql-test/t/partition.test31
-rw-r--r--mysql-test/t/partition_mgm_err.test2
4 files changed, 67 insertions, 2 deletions
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