summaryrefslogtreecommitdiff
path: root/mysql-test/suite/versioning/r/simple.result
blob: e0af556f0731a1d15e5f75b60a7e24bb94662c07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
create or replace table dept (
dept_id int(10) primary key, 
name varchar(100)
)
with system versioning;
create or replace table emp (
emp_id int(10) primary key,
dept_id int(10),
name varchar(100),
salary int(10),
constraint `dept-emp-fk`
    foreign key (dept_id) references dept (dept_id)
on delete cascade
on update restrict
) 
with system versioning;
select now() into @ts_0;
insert into dept (dept_id, name) values (10, "accounting");
commit;
select vtq_commit_ts(sys_trx_start) into @ts_1 from dept where dept_id=10;
insert into emp (emp_id, name, salary, dept_id) values (1, "bill", 1000, 10);
commit;
select vtq_commit_ts(sys_trx_start) into @ts_2 from emp where name="bill";
select * from emp;
emp_id	dept_id	name	salary
1	10	bill	1000
update emp set salary=2000 where name="bill";
commit;
select vtq_commit_ts(sys_trx_start) into @ts_3 from emp where name="bill";
select * from emp;
emp_id	dept_id	name	salary
1	10	bill	2000
select * from emp for system_time as of timestamp @ts_2;
emp_id	dept_id	name	salary
1	10	bill	1000
select * from emp for system_time as of timestamp @ts_3;
emp_id	dept_id	name	salary
1	10	bill	2000
select * from emp e, dept d
where d.dept_id = 10
and d.dept_id = e.dept_id;
emp_id	dept_id	name	salary	dept_id	name
1	10	bill	2000	10	accounting
select * from emp e, dept d
where d.dept_id = 10
and d.dept_id = e.dept_id
system_time from timestamp @ts_1 to timestamp @ts_2;
emp_id	dept_id	name	salary	sys_trx_start	sys_trx_end	dept_id	name	sys_trx_start	sys_trx_end
select * from emp e, dept d
where d.dept_id = 10
and d.dept_id = e.dept_id
system_time as of timestamp @ts_0;
emp_id	dept_id	name	salary	dept_id	name
select * from emp e, dept d
where d.dept_id = 10
and d.dept_id = e.dept_id
system_time as of timestamp @ts_1;
emp_id	dept_id	name	salary	dept_id	name
select * from emp e, dept d
where d.dept_id = 10
and d.dept_id = e.dept_id
system_time as of timestamp @ts_2;
emp_id	dept_id	name	salary	dept_id	name
1	10	bill	1000	10	accounting
select * from emp e, dept d
where d.dept_id = 10
and d.dept_id = e.dept_id
system_time as of timestamp @ts_3;
emp_id	dept_id	name	salary	dept_id	name
1	10	bill	2000	10	accounting
drop table emp, dept;