1-- source include/have_partition.inc
2--disable_warnings
3DROP TABLE IF EXISTS t1;
4--enable_warnings
5
6#
7# Bug 40389: REORGANIZE PARTITION crashes when only using one partition
8#
9CREATE TABLE t1 (a INT PRIMARY KEY)
10ENGINE MYISAM
11PARTITION BY HASH (a)
12PARTITIONS 1;
13INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
14ALTER TABLE t1 REORGANIZE PARTITION;
15DROP TABLE t1;
16
17#
18# Bug 21143: mysqld hang when error in number of subparts in
19#            REORGANIZE command
20#
21create table t1 (a int)
22partition by range (a)
23subpartition by key (a)
24(partition p0 values less than (10) (subpartition sp00, subpartition sp01),
25 partition p1 values less than (20) (subpartition sp10, subpartition sp11));
26
27-- error ER_PARTITION_WRONG_NO_SUBPART_ERROR
28alter table t1 reorganize partition p0 into
29(partition p0 values less than (10) (subpartition sp00,
30subpartition sp01, subpartition sp02));
31drop table t1;
32
33CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
34PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2;
35SHOW CREATE TABLE t1;
36let $MYSQLD_DATADIR= `select @@datadir`;
37-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
38-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
39-- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD
40-- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI
41-- file_exists $MYSQLD_DATADIR/test/t1.frm
42-- file_exists $MYSQLD_DATADIR/test/t1.par
43ALTER TABLE t1 COALESCE PARTITION 1;
44SHOW CREATE TABLE t1;
45-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
46-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
47-- file_exists $MYSQLD_DATADIR/test/t1.frm
48-- file_exists $MYSQLD_DATADIR/test/t1.par
49drop table t1;
50#
51# Bug 20767: REORGANIZE partition crashes
52#
53create table t1 (a int)
54partition by list (a)
55subpartition by hash (a)
56(partition p11 values in (1,2),
57 partition p12 values in (3,4));
58
59alter table t1 REORGANIZE partition p11, p12 INTO
60(partition p1 values in (1,2,3,4));
61
62alter table t1 REORGANIZE partition p1 INTO
63(partition p11 values in (1,2),
64 partition p12 values in (3,4));
65
66drop table t1;
67#
68# Verification tests for bug#14326
69#
70CREATE TABLE t1 (a INT)
71/*!50100 PARTITION BY HASH (a)
72/* Test
73   of multi-line
74   comment */
75PARTITIONS 5 */;
76SHOW CREATE TABLE t1;
77DROP TABLE t1;
78CREATE TABLE t1 (a INT)
79/*!50100 PARTITION BY HASH (a)
80-- with a single line comment embedded
81PARTITIONS 5 */;
82SHOW CREATE TABLE t1;
83DROP TABLE t1;
84CREATE TABLE t1 (a INT)
85/*!50100 PARTITION BY HASH (a)
86PARTITIONS 5 */;
87SHOW CREATE TABLE t1;
88DROP TABLE t1;
89CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */;
90SHOW CREATE TABLE t1;
91DROP TABLE t1;
92