Skip to content

Commit aa29266

Browse files
committed
Parser: moved 'for system_time' before alias
Due to standard (see 7.6 <table reference>).
1 parent a5ec9fc commit aa29266

File tree

9 files changed

+40
-32
lines changed

9 files changed

+40
-32
lines changed

mysql-test/suite/versioning/r/cte.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ ancestors
3333
as
3434
(
3535
select e.emp_id, e.name, e.mgr, e.salary
36-
from emp as e for system_time as of timestamp @ts_1
36+
from emp for system_time as of timestamp @ts_1 as e
3737
where name = 'bill'
3838
union
3939
select e.emp_id, e.name, e.mgr, e.salary
40-
from emp as e for system_time as of timestamp @ts_1,
40+
from emp for system_time as of timestamp @ts_1 as e,
4141
ancestors as a
4242
where e.mgr = a.emp_id
4343
)
@@ -51,11 +51,11 @@ ancestors
5151
as
5252
(
5353
select e.emp_id, e.name, e.mgr, e.salary
54-
from emp as e for system_time as of timestamp @ts_2
54+
from emp for system_time as of timestamp @ts_2 as e
5555
where name = 'bill'
5656
union
5757
select e.emp_id, e.name, e.mgr, e.salary
58-
from emp as e for system_time as of timestamp @ts_2,
58+
from emp for system_time as of timestamp @ts_2 as e,
5959
ancestors as a
6060
where e.mgr = a.emp_id
6161
)

mysql-test/suite/versioning/r/derived.result

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,14 @@ ancestors
9191
as
9292
(
9393
select e.emp_id, e.name, e.mgr
94-
from emp as e for system_time as of timestamp @ts
94+
from emp as e
9595
where name = 'bill'
96-
union
96+
system_time as of timestamp @ts
97+
union
9798
select ee.emp_id, ee.name, ee.mgr
98-
from emp as ee for system_time as of timestamp @ts, ancestors as a for system_time as of timestamp @ts
99+
from emp as ee, ancestors as a
99100
where ee.mgr = a.emp_id
101+
system_time as of timestamp @ts
100102
)
101103
select * from ancestors;
102104
emp_id name mgr
@@ -109,12 +111,14 @@ ancestors
109111
as
110112
(
111113
select e.emp_id, e.name, e.mgr
112-
from emp as e for system_time as of timestamp @ts
114+
from emp as e
113115
where name = 'bill'
116+
system_time as of timestamp @ts
114117
union
115118
select ee.emp_id, ee.name, ee.mgr
116-
from emp as ee for system_time as of timestamp @ts, ancestors as a for system_time as of timestamp @ts
119+
from emp as ee, ancestors as a
117120
where ee.mgr = a.emp_id
121+
system_time as of timestamp @ts
118122
)
119123
select * from ancestors";
120124
prepare stmt from @tmp;

mysql-test/suite/versioning/r/vtmd.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ declare continue handler for not found set cur_done = true;
88
set @tmp= concat('
99
create or replace temporary table
1010
cur_tmp as
11-
select vtmd.archive_name from ', vtmd_name, ' as vtmd
12-
for system_time all
11+
select vtmd.archive_name from ', vtmd_name, '
12+
for system_time all as vtmd
1313
where vtmd.archive_name is not null
1414
group by vtmd.archive_name');
1515
prepare stmt from @tmp; execute stmt; drop prepare stmt;
@@ -29,8 +29,8 @@ begin
2929
set @tmp= concat('
3030
create or replace temporary table
3131
tmp_vtmd with system versioning as
32-
select * from ', vtmd_name, ' as vtmd
33-
for system_time all');
32+
select * from ', vtmd_name, '
33+
for system_time all as vtmd');
3434
prepare stmt from @tmp; execute stmt; drop prepare stmt;
3535
set @inf= 0xFFFFFFFFFFFFFFFF + 0;
3636
set @start= null;

mysql-test/suite/versioning/r/vtmd_show.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ declare continue handler for not found set cur_done = true;
88
set @tmp= concat('
99
create or replace temporary table
1010
cur_tmp as
11-
select vtmd.archive_name from ', vtmd_name, ' as vtmd
12-
for system_time all
11+
select vtmd.archive_name from ', vtmd_name, '
12+
for system_time all as vtmd
1313
where vtmd.archive_name is not null
1414
group by vtmd.archive_name');
1515
prepare stmt from @tmp; execute stmt; drop prepare stmt;

mysql-test/suite/versioning/t/cte.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ ancestors
3939
as
4040
(
4141
select e.emp_id, e.name, e.mgr, e.salary
42-
from emp as e for system_time as of timestamp @ts_1
42+
from emp for system_time as of timestamp @ts_1 as e
4343
where name = 'bill'
4444
union
4545
select e.emp_id, e.name, e.mgr, e.salary
46-
from emp as e for system_time as of timestamp @ts_1,
46+
from emp for system_time as of timestamp @ts_1 as e,
4747
ancestors as a
4848
where e.mgr = a.emp_id
4949
)
@@ -55,11 +55,11 @@ ancestors
5555
as
5656
(
5757
select e.emp_id, e.name, e.mgr, e.salary
58-
from emp as e for system_time as of timestamp @ts_2
58+
from emp for system_time as of timestamp @ts_2 as e
5959
where name = 'bill'
6060
union
6161
select e.emp_id, e.name, e.mgr, e.salary
62-
from emp as e for system_time as of timestamp @ts_2,
62+
from emp for system_time as of timestamp @ts_2 as e,
6363
ancestors as a
6464
where e.mgr = a.emp_id
6565
)

mysql-test/suite/versioning/t/derived.test

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@ ancestors
6262
as
6363
(
6464
select e.emp_id, e.name, e.mgr
65-
from emp as e for system_time as of timestamp @ts
65+
from emp as e
6666
where name = 'bill'
67+
system_time as of timestamp @ts
6768
union
6869
select ee.emp_id, ee.name, ee.mgr
69-
from emp as ee for system_time as of timestamp @ts, ancestors as a for system_time as of timestamp @ts
70+
from emp as ee, ancestors as a
7071
where ee.mgr = a.emp_id
72+
system_time as of timestamp @ts
7173
)
7274
select * from ancestors;
7375
set @tmp= "
@@ -76,12 +78,14 @@ ancestors
7678
as
7779
(
7880
select e.emp_id, e.name, e.mgr
79-
from emp as e for system_time as of timestamp @ts
81+
from emp as e
8082
where name = 'bill'
83+
system_time as of timestamp @ts
8184
union
8285
select ee.emp_id, ee.name, ee.mgr
83-
from emp as ee for system_time as of timestamp @ts, ancestors as a for system_time as of timestamp @ts
86+
from emp as ee, ancestors as a
8487
where ee.mgr = a.emp_id
88+
system_time as of timestamp @ts
8589
)
8690
select * from ancestors";
8791
prepare stmt from @tmp; execute stmt; drop prepare stmt;

mysql-test/suite/versioning/t/vtmd.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ begin
1111
set @tmp= concat('
1212
create or replace temporary table
1313
cur_tmp as
14-
select vtmd.archive_name from ', vtmd_name, ' as vtmd
15-
for system_time all
14+
select vtmd.archive_name from ', vtmd_name, '
15+
for system_time all as vtmd
1616
where vtmd.archive_name is not null
1717
group by vtmd.archive_name');
1818
prepare stmt from @tmp; execute stmt; drop prepare stmt;
@@ -37,8 +37,8 @@ begin
3737
set @tmp= concat('
3838
create or replace temporary table
3939
tmp_vtmd with system versioning as
40-
select * from ', vtmd_name, ' as vtmd
41-
for system_time all');
40+
select * from ', vtmd_name, '
41+
for system_time all as vtmd');
4242
prepare stmt from @tmp; execute stmt; drop prepare stmt;
4343

4444
set @inf= 0xFFFFFFFFFFFFFFFF + 0;

mysql-test/suite/versioning/t/vtmd_show.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ begin
1010
set @tmp= concat('
1111
create or replace temporary table
1212
cur_tmp as
13-
select vtmd.archive_name from ', vtmd_name, ' as vtmd
14-
for system_time all
13+
select vtmd.archive_name from ', vtmd_name, '
14+
for system_time all as vtmd
1515
where vtmd.archive_name is not null
1616
group by vtmd.archive_name');
1717
prepare stmt from @tmp; execute stmt; drop prepare stmt;

sql/sql_yacc.yy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11334,17 +11334,17 @@ table_primary_ident:
1133411334
SELECT_LEX *sel= Select;
1133511335
sel->table_join_options= 0;
1133611336
}
11337-
table_ident opt_use_partition opt_table_alias opt_key_definition opt_for_system_time_clause
11337+
table_ident opt_use_partition opt_for_system_time_clause opt_table_alias opt_key_definition
1133811338
{
11339-
if (!($$= Select->add_table_to_list(thd, $2, $4,
11339+
if (!($$= Select->add_table_to_list(thd, $2, $5,
1134011340
Select->get_table_join_options(),
1134111341
YYPS->m_lock_type,
1134211342
YYPS->m_mdl_type,
1134311343
Select->pop_index_hints(),
1134411344
$3)))
1134511345
MYSQL_YYABORT;
1134611346
Select->add_joined_table($$);
11347-
if ($6)
11347+
if ($4)
1134811348
$$->vers_conditions= Lex->vers_conditions;
1134911349
}
1135011350
;

0 commit comments

Comments
 (0)