Commit eff649eb authored by Aleksey Midenkov's avatar Aleksey Midenkov

Parser: syntax extension FOR SYSTEM_TIME ALL

parent 9a7a9ae9
......@@ -59,6 +59,7 @@ select x as FROMTO_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to
select x as BETWAND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as FROMTO_ext_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_ext_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as ALL_x, y from t1 for system_time all;
if engine = 'innodb' then
select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
select x as FROMTO2_x, y from t1 for system_time from transaction 0 to transaction @x1;
......@@ -169,6 +170,18 @@ BETWAND_ext_x y
8 108
9 109
3 33
ALL_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_start)');
x y
0 100
......@@ -236,6 +249,18 @@ BETWAND_ext_x y
8 108
9 109
3 33
ALL_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
ASOF2_x y
0 100
1 101
......
......@@ -48,6 +48,7 @@ begin
select x as BETWAND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as FROMTO_ext_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_ext_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as ALL_x, y from t1 for system_time all;
if engine = 'innodb' then
select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
......@@ -77,18 +78,18 @@ begin
prepare stmt from @str; execute stmt; drop prepare stmt;
set @str= concat('create or replace table t2', @str0);
prepare stmt from @str; execute stmt; drop prepare stmt;
insert into t1 values (1, 1), (1, 2), (1, 3), (4, 4), (5, 5);
insert into t2 values (1, 2), (2, 1), (3, 1);
set @t0= now(6);
select t1.x as IJ1_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 LJ1_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 RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x;
delete from t1;
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
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
......
......@@ -8712,6 +8712,16 @@ opt_for_system_time_clause:
MYSQL_YYABORT;
Lex->current_select->vers_conditions.init(FOR_SYSTEM_TIME_AS_OF, UNIT_TIMESTAMP, item);
}
| FOR_SYSTEM_TIME_SYM ALL
{
static MYSQL_TIME min= { TIMESTAMP_MIN_YEAR, 1, 1, 0, 0, 0, 0, false, MYSQL_TIMESTAMP_DATETIME };
static MYSQL_TIME max= { TIMESTAMP_MAX_YEAR, 12, 31, 23, 59, 59, 0, false, MYSQL_TIMESTAMP_DATETIME };
Item *t0= new (thd->mem_root) Item_datetime_literal(thd, &min);
Item *t1= new (thd->mem_root) Item_datetime_literal(thd, &max);
if (!t0 || !t1)
MYSQL_YYABORT;
Lex->current_select->vers_conditions.init(FOR_SYSTEM_TIME_BETWEEN, UNIT_TIMESTAMP, t0, t1);
}
| FOR_SYSTEM_TIME_SYM
FROM
trans_or_timestamp
......
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