1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-30 05:23:50 +03:00
Files
mariadb/mysql-test/suite/versioning/t/truncate.test
Aleksey Midenkov 4624e565f3 System Versioning 1.0 pre6
Merge remote-tracking branch 'mariadb/bb-10.3-temporal-serg' into trunk
2017-12-15 18:12:18 +03:00

44 lines
1.2 KiB
Plaintext

--source suite/versioning/engines.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;
--real_sleep 0.01
set @ts1=now(6);
--real_sleep 0.01
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;
--echo ### Issue #399, truncate partitioned table is now unimplemented
create or replace table t (a int)
with system versioning
engine myisam
partition by system_time (
partition p0 history,
partition pn current);
--error ER_NOT_ALLOWED_COMMAND
truncate table t to system_time current_timestamp;
drop table t;