polardbxengine/mysql-test/suite/xengine_main/t/partition_truncate.test

50 lines
1.4 KiB
Plaintext

#
# Simple tests to verify truncate partition syntax
#
--disable_warnings
drop table if exists t1, t2, t3, t4;
--enable_warnings
create table t1 (a int)
partition by list (a)
(partition p1 values in (0));
alter table t1 truncate partition p1,p1;
--error ER_UNKNOWN_PARTITION
alter table t1 truncate partition p0;
drop table t1;
create table t1 (a int)
partition by list (a)
subpartition by hash (a)
subpartitions 1
(partition p1 values in (1)
(subpartition sp1));
alter table t1 truncate partition sp1;
drop table t1;
create table t1 (a int);
insert into t1 values (1), (3), (8);
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
alter table t1 truncate partition p0;
select count(*) from t1;
drop table t1;
--echo # Additional coverage for WL#7743 "New data dictionary: changes
--echo # to DDL-related parts of SE API".
--echo #
--echo # Test how failed call to Partition_handler::truncate_partition()
--echo # is handled.
call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* Missing .ibd file for table `test`\.`t1` .* ");
create table t1 (id int)
partition by range (id)
(partition p0 values less than (1000),
partition p1 values less than (maxvalue));
--echo # Discard partition's tablespace to force
--echo # Partition_handler::truncate_partition() failure.
alter table t1 discard partition p0 tablespace;
--error ER_TABLESPACE_DISCARDED
alter table t1 truncate partition p0;
drop table t1;
--source suite/xengine/include/check_xengine_log_error.inc