1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Parser: moved 'for system_time' before alias

Due to standard (see 7.6 <table reference>).
This commit is contained in:
Aleksey Midenkov
2017-07-23 17:07:56 +03:00
parent a5ec9fc1b4
commit aa292666cc
9 changed files with 40 additions and 32 deletions

View File

@ -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
)

View File

@ -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'
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;

View File

@ -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;

View File

@ -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;

View File

@ -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
)

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
;