1drop table if exists t1;
2CREATE TABLE t1 (a int, b int)
3PARTITION BY RANGE (a)
4(PARTITION x0 VALUES LESS THAN (2),
5PARTITION x1 VALUES LESS THAN (4),
6PARTITION x2 VALUES LESS THAN (6),
7PARTITION x3 VALUES LESS THAN (8),
8PARTITION x4 VALUES LESS THAN (10),
9PARTITION x5 VALUES LESS THAN (12),
10PARTITION x6 VALUES LESS THAN (14),
11PARTITION x7 VALUES LESS THAN (16),
12PARTITION x8 VALUES LESS THAN (18),
13PARTITION x9 VALUES LESS THAN (20));
14ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
15(PARTITION x01 VALUES LESS THAN (2),
16PARTITION x11 VALUES LESS THAN (5));
17ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
18ALTER TABLE t1 DROP PARTITION x0, x1, x2, x3, x3;
19ERROR HY000: Error in list of partitions to DROP
20ALTER TABLE t1 DROP PARTITION x0, x1, x2, x10;
21ERROR HY000: Error in list of partitions to DROP
22ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
23ERROR HY000: Error in list of partitions to DROP
24ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
25ERROR HY000: Error in list of partitions to DROP
26ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
27(PARTITION x11 VALUES LESS THAN (22));
28ERROR HY000: More partitions to reorganize than there are partitions
29ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
30(PARTITION x3 VALUES LESS THAN (6));
31ERROR HY000: Duplicate partition name x3
32ALTER TABLE t1 REORGANIZE PARTITION x0, x2 INTO
33(PARTITION x11 VALUES LESS THAN (2));
34ERROR HY000: When reorganizing a set of partitions they must be in consecutive order
35ALTER TABLE t1 REORGANIZE PARTITION x0, x1, x1 INTO
36(PARTITION x11 VALUES LESS THAN (4));
37ERROR HY000: Error in list of partitions to REORGANIZE
38ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
39(PARTITION x01 VALUES LESS THAN (5));
40ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
41ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
42(PARTITION x01 VALUES LESS THAN (4),
43PARTITION x11 VALUES LESS THAN (2));
44ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
45ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
46(PARTITION x01 VALUES LESS THAN (6),
47PARTITION x11 VALUES LESS THAN (4));
48ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
49DROP TABLE t1;
50CREATE TABLE t1 (a int)
51PARTITION BY KEY (a)
52PARTITIONS 2;
53ALTER TABLE t1 ADD PARTITION (PARTITION p1);
54ERROR HY000: Duplicate partition name p1
55DROP TABLE t1;
56CREATE TABLE t1 (a int)
57PARTITION BY KEY (a)
58(PARTITION x0, PARTITION x1, PARTITION x2, PARTITION x3, PARTITION x3);
59ERROR HY000: Duplicate partition name x3
60CREATE TABLE t1 (a int)
61PARTITION BY RANGE (a)
62SUBPARTITION BY KEY (a)
63SUBPARTITIONS 2
64(PARTITION x0 VALUES LESS THAN (4),
65PARTITION x1 VALUES LESS THAN (8));
66ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (5)
67(SUBPARTITION sp0, SUBPARTITION sp1));
68ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
69ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES LESS THAN (12)
70(SUBPARTITION sp0, SUBPARTITION sp1, SUBPARTITION sp2));
71ERROR HY000: Trying to Add partition(s) with wrong number of subpartitions
72DROP TABLE t1;
73CREATE TABLE t1 (a int)
74PARTITION BY LIST (a)
75(PARTITION x0 VALUES IN (1,2,3),
76PARTITION x1 VALUES IN (4,5,6));
77ALTER TABLE t1 ADD PARTITION (PARTITION x2 VALUES IN (3,4));
78ERROR HY000: Multiple definition of same constant in list partitioning
79DROP TABLE t1;
80CREATE TABLE t1 (a int);
81ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
82ERROR HY000: Partition management on a not partitioned table is not possible
83ALTER TABLE t1 DROP PARTITION x1;
84ERROR HY000: Partition management on a not partitioned table is not possible
85ALTER TABLE t1 COALESCE PARTITION 1;
86ERROR HY000: Partition management on a not partitioned table is not possible
87ALTER TABLE t1 ANALYZE PARTITION p1;
88Table	Op	Msg_type	Msg_text
89test.t1	analyze	Error	Partition management on a not partitioned table is not possible
90test.t1	analyze	status	Operation failed
91ALTER TABLE t1 CHECK PARTITION p1;
92Table	Op	Msg_type	Msg_text
93test.t1	check	Error	Partition management on a not partitioned table is not possible
94test.t1	check	status	Operation failed
95ALTER TABLE t1 OPTIMIZE PARTITION p1;
96Table	Op	Msg_type	Msg_text
97test.t1	optimize	Error	Partition management on a not partitioned table is not possible
98test.t1	optimize	status	Operation failed
99ALTER TABLE t1 REPAIR PARTITION p1;
100Table	Op	Msg_type	Msg_text
101test.t1	repair	Error	Partition management on a not partitioned table is not possible
102test.t1	repair	status	Operation failed
103DROP TABLE t1;
104CREATE TABLE t1 (a int)
105PARTITION BY KEY (a)
106(PARTITION x0, PARTITION x1);
107ALTER TABLE t1 ADD PARTITION PARTITIONS 0;
108ERROR HY000: At least one partition must be added
109ALTER TABLE t1 ADD PARTITION PARTITIONS 8192;
110ERROR HY000: Too many partitions (including subpartitions) were defined
111ALTER TABLE t1 DROP PARTITION x0;
112ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions
113ALTER TABLE t1 COALESCE PARTITION 1;
114ALTER TABLE t1 COALESCE PARTITION 1;
115ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
116DROP TABLE t1;
117CREATE TABLE t1 (a int)
118PARTITION BY RANGE (a)
119(PARTITION x0 VALUES LESS THAN (4),
120PARTITION x1 VALUES LESS THAN (8));
121ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
122ERROR HY000: For RANGE partitions each partition must be defined
123ALTER TABLE t1 DROP PARTITION x2;
124ERROR HY000: Error in list of partitions to DROP
125ALTER TABLE t1 COALESCE PARTITION 1;
126ERROR HY000: COALESCE PARTITION can only be used on HASH/KEY partitions
127ALTER TABLE t1 DROP PARTITION x1;
128ALTER TABLE t1 DROP PARTITION x0;
129ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
130DROP TABLE t1;
131CREATE TABLE t1 ( id INT NOT NULL,
132fname VARCHAR(50) NOT NULL,
133lname VARCHAR(50) NOT NULL,
134hired DATE NOT NULL )
135PARTITION BY RANGE(YEAR(hired)) (
136PARTITION p1 VALUES LESS THAN (1991),
137PARTITION p2 VALUES LESS THAN (1996),
138PARTITION p3 VALUES LESS THAN (2001),
139PARTITION p4 VALUES LESS THAN (2005));
140ALTER TABLE t1 ADD PARTITION (
141PARTITION p5 VALUES LESS THAN (2010),
142PARTITION p6 VALUES LESS THAN MAXVALUE);
143DROP TABLE t1;
144CREATE TABLE t1 (a INT);
145SHOW CREATE TABLE t1;
146Table	Create Table
147t1	CREATE TABLE `t1` (
148  `a` int(11) DEFAULT NULL
149) ENGINE=ENGINE DEFAULT CHARSET=latin1
150ALTER TABLE t1 PARTITION BY KEY(a) PARTITIONS 2;
151SHOW CREATE TABLE t1;
152Table	Create Table
153t1	CREATE TABLE `t1` (
154  `a` int(11) DEFAULT NULL
155) ENGINE=ENGINE DEFAULT CHARSET=latin1
156/*!50100 PARTITION BY KEY (a)
157PARTITIONS 2 */
158DROP TABLE t1;
159CREATE TABLE t1 (a INT) PARTITION BY HASH(a);
160ALTER TABLE t1 ADD PARTITION PARTITIONS 4;
161DROP TABLE t1;
162CREATE TABLE t1 (s1 int, s2 int)
163PARTITION BY LIST (s1)
164SUBPARTITION BY KEY (s2) (
165PARTITION p1 VALUES IN (0) (SUBPARTITION p1b),
166PARTITION p2 VALUES IN (2) (SUBPARTITION p1b)
167);
168ERROR HY000: Duplicate partition name p1b
169#
170# Bug#20284744: COMMANDS OUT OF SYNC, MALFORMED PACKET, HANG,
171# DISCONNECTIONS
172#
173create table t1 (a int) engine=innodb;
174create procedure `p1`()
175begin
176declare `c`  cursor for select 1 ;
177declare continue handler for sqlexception begin select 1; end ;
178alter table t1 check partition a;
179open `c`;
180end $
181# Without the fix this would fail with 2027: Malformed packet
182call p1();
183Table	Op	Msg_type	Msg_text
184test.t1	check	Error	Partition management on a not partitioned table is not possible
185test.t1	check	status	Operation failed
186# Without the fix the connection would get out of sync here (error 2014)!
187call p1();
188Table	Op	Msg_type	Msg_text
189test.t1	check	Error	Partition management on a not partitioned table is not possible
190test.t1	check	status	Operation failed
191drop procedure p1;
192drop table t1;
193