1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-25468 DELETE HISTORY may delete current data on system-versioned table

Item_func_history (is_history()) is a bool function that checks if the
row is the history row by checking row_end->is_max(). The argument to
this function must be row_end system field.

Added the above function to conjunction with SYSTEM_TIME_BEFORE
versioning condition.
This commit is contained in:
Aleksey Midenkov
2021-04-21 22:14:08 +03:00
parent 29b2f3dbb5
commit 6d73282b13
5 changed files with 105 additions and 2 deletions

View File

@@ -141,4 +141,26 @@ insert into t1 values (1);
select * from t1;
drop table t1;
--echo #
--echo # MDEV-25468 DELETE HISTORY may delete current data on system-versioned table
--echo #
create or replace table t1 (x int) with system versioning;
insert into t1 values (1);
delete history from t1 before system_time '2039-01-01 23:00';
select * from t1;
explain extended delete history from t1 before system_time '2039-01-01 23:00';
create or replace procedure p() delete history from t1 before system_time '2039-01-01 23:00';
call p;
select * from t1;
call p;
select * from t1;
drop procedure p;
prepare stmt from "delete history from t1 before system_time '2039-01-01 23:00'";
execute stmt;
select * from t1;
execute stmt;
select * from t1;
drop prepare stmt;
drop table t1;
--source suite/versioning/common_finish.inc