mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / partition_mgm.test
blobbf9b5ed174e470b45ecaea8530f4aeeae197ab89
1 -- source include/have_partition.inc
2 --disable_warnings
3 DROP TABLE IF EXISTS t1;
4 --enable_warnings
7 # Bug 40389: REORGANIZE PARTITION crashes when only using one partition
9 CREATE TABLE t1 (a INT PRIMARY KEY)
10 ENGINE MYISAM
11 PARTITION BY HASH (a)
12 PARTITIONS 1;
13 INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
14 ALTER TABLE t1 REORGANIZE PARTITION;
15 DROP TABLE t1;
18 # Bug 21143: mysqld hang when error in number of subparts in
19 #            REORGANIZE command
21 create table t1 (a int)
22 partition by range (a)
23 subpartition 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));
27 -- error ER_PARTITION_WRONG_NO_SUBPART_ERROR
28 alter table t1 reorganize partition p0 into
29 (partition p0 values less than (10) (subpartition sp00,
30 subpartition sp01, subpartition sp02));
31 drop table t1;
33 CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
34 PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2;
35 SHOW CREATE TABLE t1;
36 let $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
43 ALTER TABLE t1 COALESCE PARTITION 1;
44 SHOW 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
49 drop table t1;
51 # Bug 20767: REORGANIZE partition crashes
53 create table t1 (a int)
54 partition by list (a)
55 subpartition by hash (a)
56 (partition p11 values in (1,2),
57  partition p12 values in (3,4));
59 alter table t1 REORGANIZE partition p11, p12 INTO
60 (partition p1 values in (1,2,3,4));
62 alter table t1 REORGANIZE partition p1 INTO
63 (partition p11 values in (1,2),
64  partition p12 values in (3,4));
66 drop table t1;
68 # Verification tests for bug#14326
70 CREATE TABLE t1 (a INT)
71 /*!50100 PARTITION BY HASH (a)
72 /* Test
73    of multi-line
74    comment */
75 PARTITIONS 5 */;
76 SHOW CREATE TABLE t1;
77 DROP TABLE t1;
78 CREATE TABLE t1 (a INT)
79 /*!50100 PARTITION BY HASH (a)
80 -- with a single line comment embedded
81 PARTITIONS 5 */;
82 SHOW CREATE TABLE t1;
83 DROP TABLE t1;
84 CREATE TABLE t1 (a INT)
85 /*!50100 PARTITION BY HASH (a)
86 PARTITIONS 5 */;
87 SHOW CREATE TABLE t1;
88 DROP TABLE t1;
89 CREATE TABLE t1 (a INT) /*!50100 PARTITION BY HASH (a) PARTITIONS 5 */;
90 SHOW CREATE TABLE t1;
91 DROP TABLE t1;