Commit 3198bc83 authored by Sergei Golubchik's avatar Sergei Golubchik Committed by Aleksey Midenkov

Parser: unreserve keywords

SELECT * FROM t1 FOR SYSTEM_TIME AS OF ...

becomes ambiguous, but it's the same as with

SELECT ... UNION SELECT ... ORDER BY ...
parent 6ac77342
...@@ -82,13 +82,13 @@ emp_id name mgr address ...@@ -82,13 +82,13 @@ emp_id name mgr address
2 bill 1 New York 2 bill 1 New York
3 kate 1 London 3 kate 1 London
4 john 1 Paris 4 john 1 Paris
with ancestors as (select * from emp natural join addr system_time all) select * from ancestors; with ancestors as (select * from emp natural join addr where 1 for system_time all) select * from ancestors;
emp_id name mgr address emp_id name mgr address
1 bill 0 Moscow 1 bill 0 Moscow
2 bill 1 New York 2 bill 1 New York
3 kate 1 London 3 kate 1 London
4 john 1 Paris 4 john 1 Paris
select * from emp natural join addr system_time all; select * from emp natural join addr where 1 for system_time all;
emp_id name mgr address emp_id name mgr address
1 bill 0 Moscow 1 bill 0 Moscow
2 bill 1 New York 2 bill 1 New York
......
...@@ -93,12 +93,12 @@ as ...@@ -93,12 +93,12 @@ as
select e.emp_id, e.name, e.mgr select e.emp_id, e.name, e.mgr
from emp as e from emp as e
where name = 'bill' where name = 'bill'
system_time as of timestamp @ts for system_time as of timestamp @ts
union union
select ee.emp_id, ee.name, ee.mgr select ee.emp_id, ee.name, ee.mgr
from emp as ee, ancestors as a from emp as ee, ancestors as a
where ee.mgr = a.emp_id where ee.mgr = a.emp_id
system_time as of timestamp @ts for system_time as of timestamp @ts
) )
select * from ancestors; select * from ancestors;
emp_id name mgr emp_id name mgr
...@@ -113,12 +113,12 @@ as ...@@ -113,12 +113,12 @@ as
select e.emp_id, e.name, e.mgr select e.emp_id, e.name, e.mgr
from emp as e from emp as e
where name = 'bill' where name = 'bill'
system_time as of timestamp @ts for system_time as of timestamp @ts
union union
select ee.emp_id, ee.name, ee.mgr select ee.emp_id, ee.name, ee.mgr
from emp as ee, ancestors as a from emp as ee, ancestors as a
where ee.mgr = a.emp_id where ee.mgr = a.emp_id
system_time as of timestamp @ts for system_time as of timestamp @ts
) )
select * from ancestors"; select * from ancestors";
prepare stmt from @tmp; prepare stmt from @tmp;
...@@ -152,13 +152,13 @@ y x ...@@ -152,13 +152,13 @@ y x
with s3 as (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) select * from s3; with s3 as (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) select * from s3;
y x y x
10 1 10 1
select * from (select *, t1.sys_trx_start from t2 for system_time as of now, t1) as s4 system_time as of timestamp @t0; select * from (select *, t1.sys_trx_start from t2 for system_time as of now, t1) as s4 for system_time as of timestamp @t0;
y x y x
10 1 10 1
with s5 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s5 for system_time as of timestamp @t0; with s5 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s5 for system_time as of timestamp @t0;
y x y x
10 1 10 1
with s6 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s6 system_time as of timestamp @t0; with s6 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s6 for system_time as of timestamp @t0;
y x y x
10 1 10 1
set @q= concat("create view vt1 as select * from t1 for system_time as of timestamp '", @t0, "'"); set @q= concat("create view vt1 as select * from t1 for system_time as of timestamp '", @t0, "'");
...@@ -174,7 +174,7 @@ x y ...@@ -174,7 +174,7 @@ x y
select * from (select *, vt1.sys_trx_end from t2, vt1) as s0; select * from (select *, vt1.sys_trx_end from t2, vt1) as s0;
y x y x
10 1 10 1
select * from (select *, vt1.sys_trx_start from t2 for system_time as of now, vt1) as s0 system_time as of timestamp @t0; select * from (select *, vt1.sys_trx_start from t2 for system_time as of now, vt1) as s0 for system_time as of timestamp @t0;
y x y x
10 1 10 1
drop table t1, t2; drop table t1, t2;
......
...@@ -25,7 +25,7 @@ a b ...@@ -25,7 +25,7 @@ a b
3 NULL 3 NULL
Warnings: Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
select count(*) from t group by b system_time as of timestamp now(6); select count(*) from t group by b for system_time as of timestamp now(6);
count(*) count(*)
2 2
Warnings: Warnings:
...@@ -44,29 +44,29 @@ a b ...@@ -44,29 +44,29 @@ a b
Warnings: Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
select * from t group by a having a=2 system_time as of timestamp now(6); select * from t group by a having a=2 for system_time as of timestamp now(6);
a b a b
Warnings: Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
select * from t group by b having b=2 system_time as of timestamp now(6); select * from t group by b having b=2 for system_time as of timestamp now(6);
a b a b
Warnings: Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
select a from t where b=2 system_time as of timestamp now(6); select a from t where b=2 for system_time as of timestamp now(6);
a a
Warnings: Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
select a from t where b=NULL system_time as of timestamp now(6); select a from t where b=NULL for system_time as of timestamp now(6);
a a
Warnings: Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
select a from t where b is NULL system_time as of timestamp now(6); select a from t where b is NULL for system_time as of timestamp now(6);
a a
1 1
3 3
Warnings: Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
select count(*), b from t group by b having b=NULL system_time as of timestamp now(6); select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6);
count(*) b count(*) b
Warnings: Warnings:
Warning 4109 Attempt to read unversioned field `b` in historical query Warning 4109 Attempt to read unversioned field `b` in historical query
......
...@@ -145,13 +145,13 @@ NULL NULL 3 1 ...@@ -145,13 +145,13 @@ NULL NULL 3 1
delete from t1; delete from t1;
delete from t2; delete from t2;
select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
IJ2_x1 y1 x2 y2 IJ2_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
1 3 1 2 1 3 1 2
select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
LJ2_x1 y1 x2 y2 LJ2_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
...@@ -159,7 +159,7 @@ LJ2_x1 y1 x2 y2 ...@@ -159,7 +159,7 @@ LJ2_x1 y1 x2 y2
4 4 NULL NULL 4 4 NULL NULL
5 5 NULL NULL 5 5 NULL NULL
select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
RJ2_x1 y1 x2 y2 RJ2_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
...@@ -276,12 +276,11 @@ create or replace table t2 (y int) with system versioning; ...@@ -276,12 +276,11 @@ create or replace table t2 (y int) with system versioning;
insert into t1 values (1), (2), (3); insert into t1 values (1), (2), (3);
delete from t1 where x = 3; delete from t1 where x = 3;
insert into t2 values (1); insert into t2 values (1);
select * from t1, t2 system_time all; select * from t1, t2 for system_time all;
x y x y
1 1 1 1
2 1 2 1
3 1 select * from t1 for system_time all, t2 for system_time all for system_time all;
select * from t1 for system_time all, t2 for system_time all system_time all;
ERROR HY000: Unused clause: 'SYSTEM_TIME' ERROR HY000: Unused clause: 'SYSTEM_TIME'
### Issue #365, bug 4 (related to #226, optimized fields) ### Issue #365, bug 4 (related to #226, optimized fields)
create or replace table t1 (i int, b int) with system versioning; create or replace table t1 (i int, b int) with system versioning;
......
...@@ -78,11 +78,11 @@ select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 ...@@ -78,11 +78,11 @@ select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2
delete from t1; delete from t1;
delete from t2; delete from t2;
select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
drop table t1; drop table t1;
drop table t2; drop table t2;
end~~ end~~
...@@ -317,12 +317,11 @@ create or replace table t2 (y int) with system versioning; ...@@ -317,12 +317,11 @@ create or replace table t2 (y int) with system versioning;
insert into t1 values (1), (2), (3); insert into t1 values (1), (2), (3);
delete from t1 where x = 3; delete from t1 where x = 3;
insert into t2 values (1); insert into t2 values (1);
select * from t1, t2 system_time all; select * from t1, t2 for system_time all;
x y x y
1 1 1 1
2 1 2 1
3 1 select * from t1 for system_time all, t2 for system_time all for system_time all;
select * from t1 for system_time all, t2 for system_time all system_time all;
ERROR HY000: Unused clause: 'SYSTEM_TIME' ERROR HY000: Unused clause: 'SYSTEM_TIME'
drop view v1; drop view v1;
drop table t1, t2; drop table t1, t2;
......
...@@ -44,28 +44,28 @@ emp_id dept_id name salary dept_id name ...@@ -44,28 +44,28 @@ emp_id dept_id name salary dept_id name
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time from timestamp @ts_1 to timestamp @ts_2; for 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 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 select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time as of timestamp @ts_0; for system_time as of timestamp @ts_0;
emp_id dept_id name salary dept_id name emp_id dept_id name salary dept_id name
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time as of timestamp @ts_1; for system_time as of timestamp @ts_1;
emp_id dept_id name salary dept_id name emp_id dept_id name salary dept_id name
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time as of timestamp @ts_2; for system_time as of timestamp @ts_2;
emp_id dept_id name salary dept_id name emp_id dept_id name salary dept_id name
1 10 bill 1000 10 accounting 1 10 bill 1000 10 accounting
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time as of timestamp @ts_3; for system_time as of timestamp @ts_3;
emp_id dept_id name salary dept_id name emp_id dept_id name salary dept_id name
1 10 bill 2000 10 accounting 1 10 bill 2000 10 accounting
drop table emp, dept; drop table emp, dept;
...@@ -76,8 +76,8 @@ insert emp values (4, 'john', 1); ...@@ -76,8 +76,8 @@ insert emp values (4, 'john', 1);
insert addr values (4, 'Paris'); insert addr values (4, 'Paris');
with ancestors as (select * from emp natural join addr) select * from ancestors; with ancestors as (select * from emp natural join addr) select * from ancestors;
with ancestors as (select * from emp natural join addr) select * from ancestors for system_time all; with ancestors as (select * from emp natural join addr) select * from ancestors for system_time all;
with ancestors as (select * from emp natural join addr system_time all) select * from ancestors; with ancestors as (select * from emp natural join addr where 1 for system_time all) select * from ancestors;
select * from emp natural join addr system_time all; select * from emp natural join addr where 1 for system_time all;
drop table emp; drop table emp;
drop table dept; drop table dept;
......
...@@ -64,12 +64,12 @@ as ...@@ -64,12 +64,12 @@ as
select e.emp_id, e.name, e.mgr select e.emp_id, e.name, e.mgr
from emp as e from emp as e
where name = 'bill' where name = 'bill'
system_time as of timestamp @ts for system_time as of timestamp @ts
union union
select ee.emp_id, ee.name, ee.mgr select ee.emp_id, ee.name, ee.mgr
from emp as ee, ancestors as a from emp as ee, ancestors as a
where ee.mgr = a.emp_id where ee.mgr = a.emp_id
system_time as of timestamp @ts for system_time as of timestamp @ts
) )
select * from ancestors; select * from ancestors;
set @tmp= " set @tmp= "
...@@ -80,12 +80,12 @@ as ...@@ -80,12 +80,12 @@ as
select e.emp_id, e.name, e.mgr select e.emp_id, e.name, e.mgr
from emp as e from emp as e
where name = 'bill' where name = 'bill'
system_time as of timestamp @ts for system_time as of timestamp @ts
union union
select ee.emp_id, ee.name, ee.mgr select ee.emp_id, ee.name, ee.mgr
from emp as ee, ancestors as a from emp as ee, ancestors as a
where ee.mgr = a.emp_id where ee.mgr = a.emp_id
system_time as of timestamp @ts for system_time as of timestamp @ts
) )
select * from ancestors"; select * from ancestors";
prepare stmt from @tmp; execute stmt; drop prepare stmt; prepare stmt from @tmp; execute stmt; drop prepare stmt;
...@@ -112,9 +112,9 @@ with s1 as (select * from t1 for system_time as of timestamp @t0, t2) select * f ...@@ -112,9 +112,9 @@ with s1 as (select * from t1 for system_time as of timestamp @t0, t2) select * f
select * from (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) as s2; select * from (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) as s2;
with s3 as (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) select * from s3; with s3 as (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) select * from s3;
# system_time propagation from outer to inner # system_time propagation from outer to inner
select * from (select *, t1.sys_trx_start from t2 for system_time as of now, t1) as s4 system_time as of timestamp @t0; select * from (select *, t1.sys_trx_start from t2 for system_time as of now, t1) as s4 for system_time as of timestamp @t0;
with s5 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s5 for system_time as of timestamp @t0; with s5 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s5 for system_time as of timestamp @t0;
with s6 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s6 system_time as of timestamp @t0; with s6 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s6 for system_time as of timestamp @t0;
# VIEW instead of t1 # VIEW instead of t1
set @q= concat("create view vt1 as select * from t1 for system_time as of timestamp '", @t0, "'"); set @q= concat("create view vt1 as select * from t1 for system_time as of timestamp '", @t0, "'");
...@@ -127,7 +127,7 @@ select * from (select * from vt1, t2) as s0; ...@@ -127,7 +127,7 @@ select * from (select * from vt1, t2) as s0;
# leading table selection # leading table selection
select * from (select *, vt1.sys_trx_end from t2, vt1) as s0; select * from (select *, vt1.sys_trx_end from t2, vt1) as s0;
# system_time propagation from outer to inner # system_time propagation from outer to inner
select * from (select *, vt1.sys_trx_start from t2 for system_time as of now, vt1) as s0 system_time as of timestamp @t0; select * from (select *, vt1.sys_trx_start from t2 for system_time as of now, vt1) as s0 for system_time as of timestamp @t0;
drop table t1, t2; drop table t1, t2;
drop view vt1; drop view vt1;
...@@ -9,15 +9,15 @@ select * from t; ...@@ -9,15 +9,15 @@ select * from t;
select a from t for system_time as of timestamp now(6); select a from t for system_time as of timestamp now(6);
select a, b, b+0 from t for system_time as of timestamp now(6); select a, b, b+0 from t for system_time as of timestamp now(6);
select * from t for system_time as of timestamp now(6); select * from t for system_time as of timestamp now(6);
select count(*) from t group by b system_time as of timestamp now(6); select count(*) from t group by b for system_time as of timestamp now(6);
select * from t for system_time as of timestamp now(6) order by b asc; select * from t for system_time as of timestamp now(6) order by b asc;
select * from t for system_time as of timestamp now(6) order by b desc; select * from t for system_time as of timestamp now(6) order by b desc;
select * from t group by a having a=2 system_time as of timestamp now(6); select * from t group by a having a=2 for system_time as of timestamp now(6);
select * from t group by b having b=2 system_time as of timestamp now(6); select * from t group by b having b=2 for system_time as of timestamp now(6);
select a from t where b=2 system_time as of timestamp now(6); select a from t where b=2 for system_time as of timestamp now(6);
select a from t where b=NULL system_time as of timestamp now(6); select a from t where b=NULL for system_time as of timestamp now(6);
select a from t where b is NULL system_time as of timestamp now(6); select a from t where b is NULL for system_time as of timestamp now(6);
select count(*), b from t group by b having b=NULL system_time as of timestamp now(6); select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6);
select a, b from t; select a, b from t;
select count(*) from t for system_time as of timestamp now(6) group by b; select count(*) from t for system_time as of timestamp now(6) group by b;
......
...@@ -85,11 +85,11 @@ delete from t1; ...@@ -85,11 +85,11 @@ delete from t1;
delete from t2; delete from t2;
select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
drop table t1; drop table t1;
drop table t2; drop table t2;
...@@ -177,10 +177,10 @@ create or replace table t2 (y int) with system versioning; ...@@ -177,10 +177,10 @@ create or replace table t2 (y int) with system versioning;
insert into t1 values (1), (2), (3); insert into t1 values (1), (2), (3);
delete from t1 where x = 3; delete from t1 where x = 3;
insert into t2 values (1); insert into t2 values (1);
select * from t1, t2 system_time all; select * from t1, t2 for system_time all;
--error ER_VERS_UNUSED_CLAUSE --error ER_VERS_UNUSED_CLAUSE
select * from t1 for system_time all, t2 for system_time all system_time all; select * from t1 for system_time all, t2 for system_time all for system_time all;
--echo ### Issue #365, bug 4 (related to #226, optimized fields) --echo ### Issue #365, bug 4 (related to #226, optimized fields)
create or replace table t1 (i int, b int) with system versioning; create or replace table t1 (i int, b int) with system versioning;
......
...@@ -94,11 +94,11 @@ begin ...@@ -94,11 +94,11 @@ begin
delete from t2; delete from t2;
select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x
system_time as of timestamp @t0; for system_time as of timestamp @t0;
drop table t1; drop table t1;
drop table t2; drop table t2;
...@@ -190,10 +190,10 @@ create or replace table t2 (y int) with system versioning; ...@@ -190,10 +190,10 @@ create or replace table t2 (y int) with system versioning;
insert into t1 values (1), (2), (3); insert into t1 values (1), (2), (3);
delete from t1 where x = 3; delete from t1 where x = 3;
insert into t2 values (1); insert into t2 values (1);
select * from t1, t2 system_time all; select * from t1, t2 for system_time all;
--error ER_VERS_UNUSED_CLAUSE --error ER_VERS_UNUSED_CLAUSE
select * from t1 for system_time all, t2 for system_time all system_time all; select * from t1 for system_time all, t2 for system_time all for system_time all;
drop view v1; drop view v1;
drop table t1, t2; drop table t1, t2;
......
...@@ -45,26 +45,26 @@ where d.dept_id = 10 ...@@ -45,26 +45,26 @@ where d.dept_id = 10
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time from timestamp @ts_1 to timestamp @ts_2; for system_time from timestamp @ts_1 to timestamp @ts_2;
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time as of timestamp @ts_0; for system_time as of timestamp @ts_0;
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time as of timestamp @ts_1; for system_time as of timestamp @ts_1;
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time as of timestamp @ts_2; for system_time as of timestamp @ts_2;
select * from emp e, dept d select * from emp e, dept d
where d.dept_id = 10 where d.dept_id = 10
and d.dept_id = e.dept_id and d.dept_id = e.dept_id
system_time as of timestamp @ts_3; for system_time as of timestamp @ts_3;
drop table emp, dept; drop table emp, dept;
...@@ -871,15 +871,16 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -871,15 +871,16 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%parse-param { THD *thd } %parse-param { THD *thd }
%lex-param { THD *thd } %lex-param { THD *thd }
/* /*
Currently there are 117 shift/reduce conflicts. Currently there are 124 shift/reduce conflicts.
We should not introduce new conflicts any more. We should not introduce new conflicts any more.
*/ */
%expect 117 %expect 124
/* /*
Comments for TOKENS. Comments for TOKENS.
For each token, please include in the same line a comment that contains For each token, please include in the same line a comment that contains
the following tags: the following tags:
SQL-2011-R : Reserved keyword as per SQL-2011
SQL-2011-N : Non Reserved keyword as per SQL-2011 SQL-2011-N : Non Reserved keyword as per SQL-2011
SQL-2003-R : Reserved keyword as per SQL-2003 SQL-2003-R : Reserved keyword as per SQL-2003
SQL-2003-N : Non Reserved keyword as per SQL-2003 SQL-2003-N : Non Reserved keyword as per SQL-2003
...@@ -890,9 +891,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -890,9 +891,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
INTERNAL : Not a real token, lex optimization INTERNAL : Not a real token, lex optimization
OPERATOR : SQL operator OPERATOR : SQL operator
FUTURE-USE : Reserved for future use FUTURE-USE : Reserved for future use
32N2439 : Reserved keywords per ISO/IEC PDTR 19075-2,
http://jtc1sc32.org/doc/N2401-2450/32N2439-text_for_ballot-PDTR_19075-2.pdf
System Versioned Tables
This makes the code grep-able, and helps maintenance. This makes the code grep-able, and helps maintenance.
*/ */
...@@ -1340,7 +1338,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1340,7 +1338,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token PERCENT_RANK_SYM %token PERCENT_RANK_SYM
%token PERCENTILE_CONT_SYM %token PERCENTILE_CONT_SYM
%token PERCENTILE_DISC_SYM %token PERCENTILE_DISC_SYM
%token PERIOD_SYM /* 32N2439 */ %token PERIOD_SYM /* SQL-2011-R */
%token PERSISTENT_SYM %token PERSISTENT_SYM
%token PHASE_SYM %token PHASE_SYM
%token PLUGINS_SYM %token PLUGINS_SYM
...@@ -1507,8 +1505,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1507,8 +1505,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token SWAPS_SYM %token SWAPS_SYM
%token SWITCHES_SYM %token SWITCHES_SYM
%token SYSDATE %token SYSDATE
%token SYSTEM /* 32N2439 */ %token SYSTEM /* SQL-2011-R */
%token SYSTEM_TIME_SYM /* 32N2439 */ %token SYSTEM_TIME_SYM /* SQL-2011-R */
%token TABLES %token TABLES
%token TABLESPACE %token TABLESPACE
%token TABLE_REF_PRIORITY %token TABLE_REF_PRIORITY
...@@ -1579,7 +1577,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1579,7 +1577,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token VARIANCE_SYM %token VARIANCE_SYM
%token VARYING /* SQL-2003-R */ %token VARYING /* SQL-2003-R */
%token VAR_SAMP_SYM %token VAR_SAMP_SYM
%token VERSIONING_SYM /* 32N2439 */ %token VERSIONING_SYM /* SQL-2011-R */
%token VIA_SYM %token VIA_SYM
%token VIEW_SYM /* SQL-2003-N */ %token VIEW_SYM /* SQL-2003-N */
%token VIRTUAL_SYM %token VIRTUAL_SYM
...@@ -9011,7 +9009,7 @@ opt_trans_or_timestamp: ...@@ -9011,7 +9009,7 @@ opt_trans_or_timestamp:
opt_system_time_clause: opt_system_time_clause:
/* empty */ /* empty */
{} {}
| SYSTEM_TIME_SYM system_time_expr | FOR_SYSTEM_TIME_SYM system_time_expr
{ {
DBUG_ASSERT(Select); DBUG_ASSERT(Select);
int used= 0; int used= 0;
...@@ -15453,6 +15451,8 @@ keyword_sp_not_data_type: ...@@ -15453,6 +15451,8 @@ keyword_sp_not_data_type:
| SUSPEND_SYM {} | SUSPEND_SYM {}
| SWAPS_SYM {} | SWAPS_SYM {}
| SWITCHES_SYM {} | SWITCHES_SYM {}
| SYSTEM {}
| SYSTEM_TIME_SYM {}
| TABLE_NAME_SYM {} | TABLE_NAME_SYM {}
| TABLES {} | TABLES {}
| TABLE_CHECKSUM_SYM {} | TABLE_CHECKSUM_SYM {}
...@@ -15478,6 +15478,7 @@ keyword_sp_not_data_type: ...@@ -15478,6 +15478,7 @@ keyword_sp_not_data_type:
| USER_SYM {} | USER_SYM {}
| USE_FRM {} | USE_FRM {}
| VARIABLES {} | VARIABLES {}
| VERSIONING_SYM {}
| VIEW_SYM {} | VIEW_SYM {}
| VIRTUAL_SYM {} | VIRTUAL_SYM {}
| VALUE_SYM {} | VALUE_SYM {}
...@@ -15485,6 +15486,7 @@ keyword_sp_not_data_type: ...@@ -15485,6 +15486,7 @@ keyword_sp_not_data_type:
| WAIT_SYM {} | WAIT_SYM {}
| WEEK_SYM {} | WEEK_SYM {}
| WEIGHT_STRING_SYM {} | WEIGHT_STRING_SYM {}
| WITHOUT {}
| WORK_SYM {} | WORK_SYM {}
| X509_SYM {} | X509_SYM {}
| XML_SYM {} | XML_SYM {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment