mariadb/mysql-test/suite/versioning/t/truncate.test
2017-09-08 10:22:24 +03:00

29 lines
911 B
Text

-- source include/have_innodb.inc
create table t (a int);
--error ER_VERSIONING_REQUIRED
truncate t to system_time now();
# TRUNCATE is not DELETE and trigger must not be called.
create or replace table t (a int) with system versioning;
insert into t values (1);
update t set a=2;
set @test = 'correct';
create trigger trg_before before delete on t for each row set @test = 'incorrect';
create trigger trg_after after delete on t for each row set @test = 'incorrect';
truncate t to system_time now(6);
select @test from t;
drop table t;
create table t (a int) with system versioning;
insert into t values (1), (2);
update t set a=11 where a=1;
set @ts1=now(6);
update t set a=22 where a=2;
select * from t for system_time all;
truncate t to system_time timestamp @ts1;
select * from t for system_time all;
truncate table t to system_time timestamp now(6);
select * from t for system_time all;
drop table t;