summaryrefslogtreecommitdiff
path: root/mysql-test/suite/versioning/r/truncate.result
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2017-07-12 11:24:03 +0300
committerAleksey Midenkov <midenok@gmail.com>2017-07-12 12:10:13 +0300
commit91c8b43e77ea1ec65eb16a178d8e63a7b3065854 (patch)
tree17c8dcf330ddc43430f7ef9671c05fd49abe2470 /mysql-test/suite/versioning/r/truncate.result
parent60e456df3328657bba1648157abd1c1aa4b0838c (diff)
downloadmariadb-git-91c8b43e77ea1ec65eb16a178d8e63a7b3065854.tar.gz
Parser: syntax for query system_time [closes #230]
Eliminated `QUERY FOR`.
Diffstat (limited to 'mysql-test/suite/versioning/r/truncate.result')
-rw-r--r--mysql-test/suite/versioning/r/truncate.result169
1 files changed, 169 insertions, 0 deletions
diff --git a/mysql-test/suite/versioning/r/truncate.result b/mysql-test/suite/versioning/r/truncate.result
new file mode 100644
index 00000000000..1ad9090f644
--- /dev/null
+++ b/mysql-test/suite/versioning/r/truncate.result
@@ -0,0 +1,169 @@
+create table t (a int);
+truncate t for system_time all;
+ERROR HY000: Unused clause: 'SYSTEM_TIME'
+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~~
+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;
+a
+2
+1
+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;
+a
+2
+select @test from t;
+@test
+correct
+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;
+a
+4
+2
+3
+truncate t for system_time timestamp between '1-1-1' and now(6);
+select * from t for system_time all;
+a
+4
+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;
+a
+5
+update t set a=6;
+call truncate_history_of_t();
+select * from t for system_time all;
+a
+6
+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;
+a
+8
+7
+update t set a=9;
+truncate t for system_time timestamp between '1-1-1' and @ts2;
+select * from t for system_time all;
+a
+9
+8
+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;
+a
+2
+1
+truncate t for system_time all;
+select * from t for system_time all;
+a
+2
+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;
+a
+4
+2
+3
+truncate t for system_time timestamp between '1-1-1' and now(6);
+select * from t for system_time all;
+a
+4
+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;
+a
+5
+update t set a=6;
+call truncate_history_of_t();
+select * from t for system_time all;
+a
+6
+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;
+a
+8
+7
+update t set a=9;
+truncate t for system_time timestamp between '1-1-1' and @ts2;
+select * from t for system_time all;
+a
+9
+8
+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;
+a
+11
+22
+1
+2
+select * from t for system_time before timestamp @ts1;
+a
+1
+truncate t for system_time before timestamp @ts1;
+select * from t for system_time all;
+a
+11
+22
+2
+truncate t for system_time before timestamp now(6);
+select * from t for system_time all;
+a
+11
+22
+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;
+a
+11
+22
+1
+2
+select * from t for system_time before timestamp @ts1;
+a
+1
+select * from t for system_time before transaction 2000;
+a
+1
+2
+truncate t for system_time before timestamp @ts1;
+select * from t for system_time all;
+a
+11
+22
+2
+truncate t for system_time before timestamp now(6);
+select * from t for system_time all;
+a
+11
+22
+drop table t;
+drop procedure truncate_history_of_t;