1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +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

@@ -42,7 +42,26 @@ from emp for system_time as of timestamp @ts_1 as e,
ancestors as a
where e.mgr = a.emp_id
)
select * from ancestors for system_time as of current_timestamp;
select * from ancestors;
emp_id name mgr salary
1 bill NULL 1000
20 john 1 500
30 jane 1 750
with recursive
ancestors
as
(
select e.emp_id, e.name, e.mgr, e.salary
from emp as e
where name = 'bill'
union
select e.emp_id, e.name, e.mgr, e.salary
from emp as e,
ancestors as a
where e.mgr = a.emp_id
)
select * from ancestors
for system_time as of timestamp @ts_1;
emp_id name mgr salary
1 bill NULL 1000
30 jane 1 750