2017-10-16 12:34:17 +02:00
|
|
|
create table t1 (
|
|
|
|
pk bigint not null auto_increment,
|
|
|
|
dt datetime default null,
|
|
|
|
unique (pk, dt)
|
|
|
|
) engine=aria row_format=dynamic
|
|
|
|
partition by range columns(dt) (
|
|
|
|
partition `p20171231` values less than ('2017-12-31'),
|
|
|
|
partition `p20181231` values less than ('2018-12-31')
|
|
|
|
);
|
|
|
|
insert into t1 values (1,'2017-09-28 15:12:00');
|
|
|
|
select * from t1;
|
|
|
|
pk dt
|
|
|
|
1 2017-09-28 15:12:00
|
|
|
|
alter table t1 drop partition p20181231;
|
|
|
|
select * from t1;
|
|
|
|
pk dt
|
|
|
|
1 2017-09-28 15:12:00
|
|
|
|
drop table t1;
|
2018-02-14 19:12:23 +01:00
|
|
|
create table t1 (a int) engine=Aria transactional=1 partition by hash(a) partitions 2;
|
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`a` int(11) DEFAULT NULL
|
2022-09-02 15:32:14 +02:00
|
|
|
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci TRANSACTIONAL=1
|
2018-02-22 14:15:24 +01:00
|
|
|
PARTITION BY HASH (`a`)
|
|
|
|
PARTITIONS 2
|
2018-02-14 19:12:23 +01:00
|
|
|
drop table t1;
|
2017-11-20 06:33:19 +01:00
|
|
|
#
|
2017-12-20 11:51:57 +01:00
|
|
|
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (i INT) ENGINE=Aria PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));;
|
|
|
|
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
|
|
|
|
ALTER TABLE t1 DROP PARTITION p1;
|
|
|
|
SELECT * FROM t1;
|
|
|
|
i
|
|
|
|
DROP TABLE t1;
|
|
|
|
#
|
2017-11-20 06:33:19 +01:00
|
|
|
# MDEV-13788 Server crash when issuing bad SQL partition syntax
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE));
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`id` int(11) DEFAULT NULL,
|
|
|
|
`d` date DEFAULT NULL
|
2022-09-02 15:32:14 +02:00
|
|
|
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
2017-12-22 11:23:39 +01:00
|
|
|
PARTITION BY RANGE COLUMNS(`d`)
|
|
|
|
(PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = Aria)
|
2017-11-20 06:33:19 +01:00
|
|
|
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
|
|
|
|
(
|
|
|
|
PARTITION p2, /* Notice no values */
|
|
|
|
PARTITION p3 VALUES LESS THAN (MAXVALUE)
|
|
|
|
);
|
|
|
|
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3));
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`id` int(11) DEFAULT NULL,
|
|
|
|
`d` date DEFAULT NULL
|
2022-09-02 15:32:14 +02:00
|
|
|
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
2017-12-22 11:23:39 +01:00
|
|
|
PARTITION BY LIST (`id`)
|
|
|
|
(PARTITION `p1` VALUES IN (1,2,3) ENGINE = Aria)
|
2017-11-20 06:33:19 +01:00
|
|
|
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
|
|
|
|
(
|
|
|
|
PARTITION p2, /* Notice no values */
|
|
|
|
PARTITION p3 VALUES IN (4,5,6)
|
|
|
|
);
|
|
|
|
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
|
|
|
|
DROP TABLE t1;
|
2022-03-29 16:41:40 +02:00
|
|
|
#
|
|
|
|
# MDEV-15456 Server crashes upon adding or dropping a partition in ALTER under LOCK TABLE after ER_SAME_NAME_PARTITION
|
|
|
|
#
|
2018-04-25 13:20:44 +02:00
|
|
|
create table t1 (i int) engine=Aria partition by range(i) (partition p0 values less than (10));
|
2018-04-20 10:10:33 +02:00
|
|
|
lock table t1 write;
|
|
|
|
alter table t1 add partition (partition p0 values less than (20));
|
|
|
|
ERROR HY000: Duplicate partition name p0
|
|
|
|
alter table t1 add partition (partition p1 values less than (20)) /* comment */;
|
|
|
|
drop table t1;
|
2022-03-29 16:41:40 +02:00
|
|
|
#
|
|
|
|
# MDEV-27065 Partitioning tables with custom data directories moves data back to default directory
|
|
|
|
#
|
|
|
|
ALTER TABLE t1 PARTITION BY RANGE(id)(
|
|
|
|
PARTITION p0 VALUES LESS THAN (1000),
|
|
|
|
PARTITION p1 VALUES LESS THAN MAXVALUE
|
|
|
|
);
|
|
|
|
Warnings:
|
|
|
|
Warning 1618 <DATA DIRECTORY> table option of old schema is ignored
|
|
|
|
DROP TABLE t1;
|
|
|
|
ALTER TABLE t2 PARTITION BY RANGE(id)(
|
|
|
|
PARTITION p0 VALUES LESS THAN (1000),
|
|
|
|
PARTITION p1 VALUES LESS THAN MAXVALUE
|
|
|
|
);
|
|
|
|
Warnings:
|
|
|
|
Warning 1618 <INDEX DIRECTORY> table option of old schema is ignored
|
|
|
|
DROP TABLE t2;
|
2021-10-29 12:04:53 +02:00
|
|
|
#
|
|
|
|
# MDEV-26127 Assertion `err != DB_DUPLICATE_KEY' failed or InnoDB: Failing assertion: id != 0 on ALTER ... REBUILD PARTITION
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (c INT) ENGINE=Aria PARTITION BY KEY(c) PARTITIONS 4;;
|
|
|
|
LOCK TABLES t1 WRITE, t1 AS a READ;
|
|
|
|
ALTER TABLE t1 REBUILD PARTITION p0;
|
|
|
|
DROP TABLE t1;
|