-- source include/have_innodb.inc create table t (a int); --error ER_VERS_UNUSED_CLAUSE truncate t for system_time all; delimiter ~~; create procedure truncate_history_of_t() begin prepare stmt from 'truncate t for system_time timestamp between \'1-1-1\' and now(6)'; execute stmt; drop prepare stmt; end~~ delimiter ;~~ create or replace table t (a int) with system versioning; insert into t values (1); update t set a=2; select * from t for system_time all; 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 for system_time all; select * from t for system_time all; select @test from t; drop trigger trg_before; drop trigger trg_after; update t set a=3; update t set a=4; truncate t for system_time as of timestamp now(6); select * from t for system_time all; truncate t for system_time timestamp between '1-1-1' and now(6); select * from t for system_time all; update t set a=5; truncate t for system_time timestamp from '1-1-1' to now(6); select * from t for system_time all; update t set a=6; call truncate_history_of_t(); select * from t for system_time all; set @ts1 = now(6); update t set a=7; set @ts2 = now(6); update t set a=8; truncate t for system_time timestamp from '1-1-1' to @ts1; select * from t for system_time all; update t set a=9; truncate t for system_time timestamp between '1-1-1' and @ts2; select * from t for system_time all; create or replace table t (a int) with system versioning engine=innodb; insert into t values (1); update t set a=2; select * from t for system_time all; truncate t for system_time all; select * from t for system_time all; update t set a=3; update t set a=4; truncate t for system_time as of timestamp now(6); select * from t for system_time all; truncate t for system_time timestamp between '1-1-1' and now(6); select * from t for system_time all; update t set a=5; truncate t for system_time timestamp from '1-1-1' to now(6); select * from t for system_time all; update t set a=6; call truncate_history_of_t(); select * from t for system_time all; set @ts1 = now(6); update t set a=7; set @ts2 = now(6); update t set a=8; truncate t for system_time timestamp from '1-1-1' to @ts1; select * from t for system_time all; update t set a=9; truncate t for system_time timestamp between '1-1-1' and @ts2; select * from t for system_time all; create or replace 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; select * from t for system_time before timestamp @ts1; truncate t for system_time before timestamp @ts1; select * from t for system_time all; truncate t for system_time before timestamp now(6); select * from t for system_time all; create or replace table t (a int) with system versioning engine=innodb; 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; select * from t for system_time before timestamp @ts1; insert into t values (33); select max(sys_trx_start) from t into @tx; select * from t for system_time before transaction @tx; truncate t for system_time before timestamp @ts1; select * from t for system_time all; truncate t for system_time before timestamp now(6); select * from t for system_time all; drop table t; drop procedure truncate_history_of_t;