summaryrefslogtreecommitdiff
path: root/mysql-test/t/partition_mgm_err.test
diff options
context:
space:
mode:
authorunknown <pappa@c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se>2005-08-19 10:26:05 -0400
committerunknown <pappa@c-4a09e253.1238-1-64736c10.cust.bredbandsbolaget.se>2005-08-19 10:26:05 -0400
commit7b79f7288552b3e3087279a5949e58722cb24df1 (patch)
tree9ce7f70969e271169278d7eeb88691a5903a77f2 /mysql-test/t/partition_mgm_err.test
parentc77f8d6e460021a6d086c7ec36a95d159c047096 (diff)
downloadmariadb-git-7b79f7288552b3e3087279a5949e58722cb24df1.tar.gz
WL #2602, #2603, #2604
Added new syntax for partition management mysql-test/t/partition_error.test: New line sql/ha_partition.cc: Added support for DROP PARTITION on-line sql/ha_partition.h: Added support for DROP PARTITION on-line sql/handler.h: Introduced state of partition Introduced extra list of temporary partitions Removed no_full_parts A couple of methods to check for duplicate names of partitions Adaptions of default checks to be useful from ALTER TABLE partition management New method on handler to drop partitions New method to check for foreign keys on table sql/lex.h: COALESCE and REORGANISE used by ALTER TABLE x COALESCE/REORGANISE PARTITION sql/mysql_priv.h: Parser needs method to check if partition management command is ongoing sql/share/errmsg.txt: A number of new error messages for partition management sql/sql_lex.h: Adapted the ALTER_INFO data structure for partition management sql/sql_partition.cc: Couple of new routines + adaption of existing for new partition management functionality sql/sql_table.cc: bin log writing into separate subroutine to minimise code duplication. Lots of new code to handle partition management sql/sql_yacc.yy: New syntax for partition management Fixed a few errors in the parser part for partitioning
Diffstat (limited to 'mysql-test/t/partition_mgm_err.test')
-rw-r--r--mysql-test/t/partition_mgm_err.test160
1 files changed, 160 insertions, 0 deletions
diff --git a/mysql-test/t/partition_mgm_err.test b/mysql-test/t/partition_mgm_err.test
new file mode 100644
index 00000000000..1d9d8a79f3d
--- /dev/null
+++ b/mysql-test/t/partition_mgm_err.test
@@ -0,0 +1,160 @@
+#
+# Simple test for the erroneos create statements using the
+# partition storage engine
+#
+-- source include/have_partition.inc
+
+#
+# Try faulty DROP PARTITION and COALESCE PARTITION
+#
+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));
+
+--error ER_REORG_OUTSIDE_RANGE
+ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (2),
+ PARTITION x11 VALUES LESS THAN (5));
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x0, x1, x2, x3, x3;
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x0, x1, x2, x10;
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
+
+--error ER_REORG_PARTITION_NOT_EXIST
+ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
+(PARTITION x11 VALUES LESS THAN (22));
+
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO
+(PARTITION x1 VALUES LESS THAN (6));
+
+--error ER_CONSECUTIVE_REORG_PARTITIONS
+ALTER TABLE t1 REORGANISE PARTITION x0, x2 INTO
+(PARTITION x11 VALUES LESS THAN (2));
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 REORGANISE PARTITION x0, x1, x1 INTO
+(PARTITION x11 VALUES LESS THAN (4));
+
+--error ER_REORG_OUTSIDE_RANGE
+ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (5));
+
+--error ER_RANGE_NOT_INCREASING_ERROR
+ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
+(PARTITION x01 VALUES LESS THAN (4),
+ PARTITION x11 VALUES LESS THAN (2));
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+PARTITIONS 2;
+
+--error ER_SAME_NAME_PARTITION
+ALTER TABLE t1 ADD PARTITION (PARTITION p1);
+
+DROP TABLE t1;
+
+--error ER_SAME_NAME_PARTITION
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+(PARTITION x0, PARTITION x1, PARTITION x2, PARTITION x3, PARTITION x3);
+
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+SUBPARTITION BY KEY (a)
+SUBPARTITIONS 2
+(PARTITION x0 VALUES LESS THAN (4),
+ PARTITION x1 VALUES LESS THAN (8));
+
+--error ER_RANGE_NOT_INCREASING_ERROR
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (5)
+(SUBPARTITION sp0, SUBPARTITION sp1));
+
+--error ER_ADD_PARTITION_SUBPART_ERROR
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (12)
+(SUBPARTITION sp0, SUBPARTITION sp1, SUBPARTITION sp2));
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int)
+PARTITION BY LIST (a)
+(PARTITION x0 VALUES IN (1,2,3),
+ PARTITION x1 VALUES IN (4,5,6));
+
+--error ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR
+ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES IN (3,4));
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int);
+
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+ALTER TABLE t1 DROP PARTITION x1;
+
+--error ER_PARTITION_MGMT_ON_NONPARTITIONED
+ALTER TABLE t1 COALESCE PARTITION 1;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int)
+PARTITION BY KEY (a)
+(PARTITION x0, PARTITION x1);
+
+--error ER_ADD_PARTITION_NO_NEW_PARTITION
+ALTER TABLE t1 ADD PARTITION PARTITIONS 0;
+
+--error ER_TOO_MANY_PARTITIONS_ERROR
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1024;
+
+--error ER_ONLY_ON_RANGE_LIST_PARTITION
+ALTER TABLE t1 DROP PARTITION x0;
+
+ALTER TABLE t1 COALESCE PARTITION 1;
+
+--error ER_DROP_LAST_PARTITION
+ALTER TABLE t1 COALESCE PARTITION 1;
+
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int)
+PARTITION BY RANGE (a)
+(PARTITION x0 VALUES LESS THAN (4),
+ PARTITION x1 VALUES LESS THAN (8));
+
+--error ER_PARTITIONS_MUST_BE_DEFINED_ERROR
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+
+--error ER_DROP_PARTITION_NON_EXISTENT
+ALTER TABLE t1 DROP PARTITION x2;
+
+--error ER_COALESCE_ONLY_ON_HASH_PARTITION
+ALTER TABLE t1 COALESCE PARTITION 1;
+
+ALTER TABLE t1 DROP PARTITION x1;
+
+--error ER_DROP_LAST_PARTITION
+ALTER TABLE t1 DROP PARTITION x0;
+
+DROP TABLE t1;