| 1 |
create table t1 ( |
| 2 |
pk bigint not null auto_increment, |
| 3 |
dt datetime default null, |
| 4 |
unique (pk, dt) |
| 5 |
) engine=aria row_format=dynamic |
| 6 |
partition by range columns(dt) ( |
| 7 |
partition `p20171231` values less than ('2017-12-31'), |
| 8 |
partition `p20181231` values less than ('2018-12-31') |
| 9 |
); |
| 10 |
insert into t1 values (1,'2017-09-28 15:12:00'); |
| 11 |
select * from t1; |
| 12 |
pk dt |
| 13 |
1 2017-09-28 15:12:00 |
| 14 |
alter table t1 drop partition p20181231; |
| 15 |
select * from t1; |
| 16 |
pk dt |
| 17 |
1 2017-09-28 15:12:00 |
| 18 |
drop table t1; |
| 19 |
create table t1 (a int) engine=Aria transactional=1 partition by hash(a) partitions 2; |
| 20 |
show create table t1; |
| 21 |
Table Create Table |
| 22 |
t1 CREATE TABLE `t1` ( |
| 23 |
`a` int(11) DEFAULT NULL |
| 24 |
) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci TRANSACTIONAL=1 |
| 25 |
PARTITION BY HASH (`a`) |
| 26 |
PARTITIONS 2 |
| 27 |
drop table t1; |
| 28 |
# |
| 29 |
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine |
| 30 |
# |
| 31 |
CREATE TABLE t1 (i INT) ENGINE=Aria PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));; |
| 32 |
ALTER TABLE t1 ROW_FORMAT=COMPRESSED; |
| 33 |
ALTER TABLE t1 DROP PARTITION p1; |
| 34 |
SELECT * FROM t1; |
| 35 |
i |
| 36 |
DROP TABLE t1; |
| 37 |
# |
| 38 |
# MDEV-13788 Server crash when issuing bad SQL partition syntax |
| 39 |
# |
| 40 |
CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE)); |
| 41 |
SHOW CREATE TABLE t1; |
| 42 |
Table Create Table |
| 43 |
t1 CREATE TABLE `t1` ( |
| 44 |
`id` int(11) DEFAULT NULL, |
| 45 |
`d` date DEFAULT NULL |
| 46 |
) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 47 |
PARTITION BY RANGE COLUMNS(`d`) |
| 48 |
(PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = Aria) |
| 49 |
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO |
| 50 |
( |
| 51 |
PARTITION p2, /* Notice no values */ |
| 52 |
PARTITION p3 VALUES LESS THAN (MAXVALUE) |
| 53 |
); |
| 54 |
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition |
| 55 |
DROP TABLE t1; |
| 56 |
CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3)); |
| 57 |
SHOW CREATE TABLE t1; |
| 58 |
Table Create Table |
| 59 |
t1 CREATE TABLE `t1` ( |
| 60 |
`id` int(11) DEFAULT NULL, |
| 61 |
`d` date DEFAULT NULL |
| 62 |
) ENGINE=Aria DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci |
| 63 |
PARTITION BY LIST (`id`) |
| 64 |
(PARTITION `p1` VALUES IN (1,2,3) ENGINE = Aria) |
| 65 |
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO |
| 66 |
( |
| 67 |
PARTITION p2, /* Notice no values */ |
| 68 |
PARTITION p3 VALUES IN (4,5,6) |
| 69 |
); |
| 70 |
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition |
| 71 |
DROP TABLE t1; |
| 72 |
# |
| 73 |
# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION |
| 74 |
# |
| 75 |
create table t1 (i int) engine=Aria partition by range(i) (partition p0 values less than (10)); |
| 76 |
lock table t1 write; |
| 77 |
alter table t1 add partition (partition p0 values less than (20)); |
| 78 |
ERROR HY000: Duplicate partition name p0 |
| 79 |
alter table t1 add partition (partition p1 values less than (20)) /* comment */; |
| 80 |
drop table t1; |
| 81 |
# |
| 82 |
# MDEV-27065 Partitioning tables with custom data directories moves data back to default directory |
| 83 |
# |
| 84 |
ALTER TABLE t1 PARTITION BY RANGE(id)( |
| 85 |
PARTITION p0 VALUES LESS THAN (1000), |
| 86 |
PARTITION p1 VALUES LESS THAN MAXVALUE |
| 87 |
); |
| 88 |
Warnings: |
| 89 |
Warning 1618 <DATA DIRECTORY> table option of old schema is ignored |
| 90 |
DROP TABLE t1; |
| 91 |
ALTER TABLE t2 PARTITION BY RANGE(id)( |
| 92 |
PARTITION p0 VALUES LESS THAN (1000), |
| 93 |
PARTITION p1 VALUES LESS THAN MAXVALUE |
| 94 |
); |
| 95 |
Warnings: |
| 96 |
Warning 1618 <INDEX DIRECTORY> table option of old schema is ignored |
| 97 |
DROP TABLE t2; |
| 98 |
# |
| 99 |
# MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION |
| 100 |
# |
| 101 |
CREATE TABLE t1 (c INT) ENGINE=Aria PARTITION BY KEY(c) PARTITIONS 4;; |
| 102 |
LOCK TABLES t1 WRITE, t1 AS a READ; |
| 103 |
ALTER TABLE t1 REBUILD PARTITION p0; |
| 104 |
DROP TABLE t1; |