Commit aa292666 authored by Aleksey Midenkov's avatar Aleksey Midenkov

Parser: moved 'for system_time' before alias

Due to standard (see 7.6 <table reference>).
parent a5ec9fc1
......@@ -33,11 +33,11 @@ ancestors
as
(
select e.emp_id, e.name, e.mgr, e.salary
from emp as e for system_time as of timestamp @ts_1
from emp for system_time as of timestamp @ts_1 as e
where name = 'bill'
union
select e.emp_id, e.name, e.mgr, e.salary
from emp as e for system_time as of timestamp @ts_1,
from emp for system_time as of timestamp @ts_1 as e,
ancestors as a
where e.mgr = a.emp_id
)
......@@ -51,11 +51,11 @@ ancestors
as
(
select e.emp_id, e.name, e.mgr, e.salary
from emp as e for system_time as of timestamp @ts_2
from emp for system_time as of timestamp @ts_2 as e
where name = 'bill'
union
select e.emp_id, e.name, e.mgr, e.salary
from emp as e for system_time as of timestamp @ts_2,
from emp for system_time as of timestamp @ts_2 as e,
ancestors as a
where e.mgr = a.emp_id
)
......
......@@ -91,12 +91,14 @@ ancestors
as
(
select e.emp_id, e.name, e.mgr
from emp as e for system_time as of timestamp @ts
from emp as e
where name = 'bill'
union
system_time as of timestamp @ts
union
select ee.emp_id, ee.name, ee.mgr
from emp as ee for system_time as of timestamp @ts, ancestors as a for system_time as of timestamp @ts
from emp as ee, ancestors as a
where ee.mgr = a.emp_id
system_time as of timestamp @ts
)
select * from ancestors;
emp_id name mgr
......@@ -109,12 +111,14 @@ ancestors
as
(
select e.emp_id, e.name, e.mgr
from emp as e for system_time as of timestamp @ts
from emp as e
where name = 'bill'
system_time as of timestamp @ts
union
select ee.emp_id, ee.name, ee.mgr
from emp as ee for system_time as of timestamp @ts, ancestors as a for system_time as of timestamp @ts
from emp as ee, ancestors as a
where ee.mgr = a.emp_id
system_time as of timestamp @ts
)
select * from ancestors";
prepare stmt from @tmp;
......
......@@ -8,8 +8,8 @@ declare continue handler for not found set cur_done = true;
set @tmp= concat('
create or replace temporary table
cur_tmp as
select vtmd.archive_name from ', vtmd_name, ' as vtmd
for system_time all
select vtmd.archive_name from ', vtmd_name, '
for system_time all as vtmd
where vtmd.archive_name is not null
group by vtmd.archive_name');
prepare stmt from @tmp; execute stmt; drop prepare stmt;
......@@ -29,8 +29,8 @@ begin
set @tmp= concat('
create or replace temporary table
tmp_vtmd with system versioning as
select * from ', vtmd_name, ' as vtmd
for system_time all');
select * from ', vtmd_name, '
for system_time all as vtmd');
prepare stmt from @tmp; execute stmt; drop prepare stmt;
set @inf= 0xFFFFFFFFFFFFFFFF + 0;
set @start= null;
......
......@@ -8,8 +8,8 @@ declare continue handler for not found set cur_done = true;
set @tmp= concat('
create or replace temporary table
cur_tmp as
select vtmd.archive_name from ', vtmd_name, ' as vtmd
for system_time all
select vtmd.archive_name from ', vtmd_name, '
for system_time all as vtmd
where vtmd.archive_name is not null
group by vtmd.archive_name');
prepare stmt from @tmp; execute stmt; drop prepare stmt;
......
......@@ -39,11 +39,11 @@ ancestors
as
(
select e.emp_id, e.name, e.mgr, e.salary
from emp as e for system_time as of timestamp @ts_1
from emp for system_time as of timestamp @ts_1 as e
where name = 'bill'
union
select e.emp_id, e.name, e.mgr, e.salary
from emp as e for system_time as of timestamp @ts_1,
from emp for system_time as of timestamp @ts_1 as e,
ancestors as a
where e.mgr = a.emp_id
)
......@@ -55,11 +55,11 @@ ancestors
as
(
select e.emp_id, e.name, e.mgr, e.salary
from emp as e for system_time as of timestamp @ts_2
from emp for system_time as of timestamp @ts_2 as e
where name = 'bill'
union
select e.emp_id, e.name, e.mgr, e.salary
from emp as e for system_time as of timestamp @ts_2,
from emp for system_time as of timestamp @ts_2 as e,
ancestors as a
where e.mgr = a.emp_id
)
......
......@@ -62,12 +62,14 @@ ancestors
as
(
select e.emp_id, e.name, e.mgr
from emp as e for system_time as of timestamp @ts
from emp as e
where name = 'bill'
system_time as of timestamp @ts
union
select ee.emp_id, ee.name, ee.mgr
from emp as ee for system_time as of timestamp @ts, ancestors as a for system_time as of timestamp @ts
from emp as ee, ancestors as a
where ee.mgr = a.emp_id
system_time as of timestamp @ts
)
select * from ancestors;
set @tmp= "
......@@ -76,12 +78,14 @@ ancestors
as
(
select e.emp_id, e.name, e.mgr
from emp as e for system_time as of timestamp @ts
from emp as e
where name = 'bill'
system_time as of timestamp @ts
union
select ee.emp_id, ee.name, ee.mgr
from emp as ee for system_time as of timestamp @ts, ancestors as a for system_time as of timestamp @ts
from emp as ee, ancestors as a
where ee.mgr = a.emp_id
system_time as of timestamp @ts
)
select * from ancestors";
prepare stmt from @tmp; execute stmt; drop prepare stmt;
......
......@@ -11,8 +11,8 @@ begin
set @tmp= concat('
create or replace temporary table
cur_tmp as
select vtmd.archive_name from ', vtmd_name, ' as vtmd
for system_time all
select vtmd.archive_name from ', vtmd_name, '
for system_time all as vtmd
where vtmd.archive_name is not null
group by vtmd.archive_name');
prepare stmt from @tmp; execute stmt; drop prepare stmt;
......@@ -37,8 +37,8 @@ begin
set @tmp= concat('
create or replace temporary table
tmp_vtmd with system versioning as
select * from ', vtmd_name, ' as vtmd
for system_time all');
select * from ', vtmd_name, '
for system_time all as vtmd');
prepare stmt from @tmp; execute stmt; drop prepare stmt;
set @inf= 0xFFFFFFFFFFFFFFFF + 0;
......
......@@ -10,8 +10,8 @@ begin
set @tmp= concat('
create or replace temporary table
cur_tmp as
select vtmd.archive_name from ', vtmd_name, ' as vtmd
for system_time all
select vtmd.archive_name from ', vtmd_name, '
for system_time all as vtmd
where vtmd.archive_name is not null
group by vtmd.archive_name');
prepare stmt from @tmp; execute stmt; drop prepare stmt;
......
......@@ -11334,9 +11334,9 @@ table_primary_ident:
SELECT_LEX *sel= Select;
sel->table_join_options= 0;
}
table_ident opt_use_partition opt_table_alias opt_key_definition opt_for_system_time_clause
table_ident opt_use_partition opt_for_system_time_clause opt_table_alias opt_key_definition
{
if (!($$= Select->add_table_to_list(thd, $2, $4,
if (!($$= Select->add_table_to_list(thd, $2, $5,
Select->get_table_join_options(),
YYPS->m_lock_type,
YYPS->m_mdl_type,
......@@ -11344,7 +11344,7 @@ table_primary_ident:
$3)))
MYSQL_YYABORT;
Select->add_joined_table($$);
if ($6)
if ($4)
$$->vers_conditions= Lex->vers_conditions;
}
;
......
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