mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-27217 DELETE partition selection doesn't work for history partitions
LIMIT history switching requires the number of history partitions to be marked for read: from first to last non-empty plus one empty. The least we can do is to fail with error message if the needed partition was not marked for read. As this is handler interface we require new handler error code to display user-friendly error message. Switching by INTERVAL works out-of-the-box with ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET error.
This commit is contained in:
@ -767,4 +767,36 @@ alter table t1 add x serial;
|
||||
alter table t1 add partition (partition p1 history);
|
||||
alter table t1 add partition (partition p2 history);
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-27217 DELETE partition selection doesn't work for history partitions
|
||||
#
|
||||
create table t1 (f char) with system versioning
|
||||
partition by system_time limit 10 (
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition p2 history,
|
||||
partition pn current);
|
||||
delete from t1 partition (p1);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
delete from t1 partition (p0, pn);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
delete from t1 partition (p0, p1);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
delete from t1 partition (p0, p1, pn);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
drop table t1;
|
||||
set timestamp=unix_timestamp('2000-01-01 00:00:00');
|
||||
create or replace table t1 (i int) with system versioning
|
||||
partition by system_time interval 1 day (
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
set timestamp=unix_timestamp('2000-01-02 00:00:00');
|
||||
insert t1 values (1);
|
||||
delete from t1 partition (p0, pn);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
delete from t1 partition (p0, p1, pn);
|
||||
ERROR HY000: Not allowed for system-versioned table `test`.`t1`
|
||||
drop table t1;
|
||||
set timestamp= default;
|
||||
# End of 10.3 tests
|
||||
|
@ -748,6 +748,40 @@ alter table t1 add partition (partition p1 history);
|
||||
alter table t1 add partition (partition p2 history);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-27217 DELETE partition selection doesn't work for history partitions
|
||||
--echo #
|
||||
create table t1 (f char) with system versioning
|
||||
partition by system_time limit 10 (
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition p2 history,
|
||||
partition pn current);
|
||||
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p1);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, pn);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, p1);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, p1, pn);
|
||||
drop table t1;
|
||||
|
||||
set timestamp=unix_timestamp('2000-01-01 00:00:00');
|
||||
create or replace table t1 (i int) with system versioning
|
||||
partition by system_time interval 1 day (
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
set timestamp=unix_timestamp('2000-01-02 00:00:00');
|
||||
insert t1 values (1);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, pn);
|
||||
--error ER_VERS_NOT_ALLOWED
|
||||
delete from t1 partition (p0, p1, pn);
|
||||
drop table t1;
|
||||
set timestamp= default;
|
||||
--echo # End of 10.3 tests
|
||||
|
||||
--source suite/versioning/common_finish.inc
|
||||
|
Reference in New Issue
Block a user