1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

SQL: derived SYSTEM_TIME clash detection [closes #371]

This commit is contained in:
Aleksey Midenkov
2017-12-06 06:14:22 +03:00
parent d04063c5b9
commit 84b718ae70
9 changed files with 145 additions and 75 deletions

View File

@ -12,12 +12,6 @@ set @vt2= concat("create or replace view vt2 as select *, sys_trx_end from t1 fo
prepare stmt from @vt2;
execute stmt;
drop prepare stmt;
select * from vt1 for system_time all;
x
1
select * from vt2 for system_time all;
x
2
select * from t1;
x
create or replace view vt1 as select * from t1;
@ -26,17 +20,7 @@ View Create View character_set_client collation_connection
vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from `t1` FOR SYSTEM_TIME ALL where `t1`.`sys_trx_end` = MAX_RESULT latin1 latin1_swedish_ci
drop view vt1;
drop view vt2;
create view vt1 as select * from t1 for system_time all;
select * from vt1 for system_time all;
x
2
1
prepare stmt from 'select * from vt1 for system_time all';
execute stmt;
x
2
1
drop prepare stmt;
create or replace view vt1 as select * from t1 for system_time all;
select * from vt1;
x
2
@ -47,39 +31,24 @@ x
2
1
drop prepare stmt;
set @str= concat('create or replace view vt1 as
select * from t1 for system_time as of timestamp "', @t1, '"');
prepare stmt from @str;
execute stmt;
drop prepare stmt;
select * from t1 for system_time as of timestamp @t1;
x
1
select * from vt1 for system_time as of timestamp @t1;
select * from vt1;
x
1
prepare stmt from 'select * from vt1 for system_time as of timestamp @t1';
execute stmt;
x
1
drop prepare stmt;
create or replace view vt1 as select * from t1;
select * from vt1 for system_time all;
x
prepare stmt from 'select * from vt1 for system_time all';
execute stmt;
x
drop prepare stmt;
insert into vt1 values (3);
select * from t1;
x
3
select * from vt1;
x
3
select * from t1 for system_time all;
x
2
1
3
select * from vt1 for system_time all;
x
3
create or replace table t1 (x int) with system versioning;
insert into t1 values (1), (2);
set @t1=now(6);
@ -91,7 +60,7 @@ set @tmp= concat("create or replace view vt1 as select * from t1 for system_time
prepare stmt from @tmp;
execute stmt;
drop prepare stmt;
select * from vt1 for system_time all;
select * from vt1;
x
1
2