MDEV-15378 Valid query causes invalid view definition due to syntax limitation in FOR SYSTEM_TIME
fix parsing of the AS OF clause
This commit is contained in:
parent
bb56a06d26
commit
1a86fc5f14
@ -107,7 +107,9 @@ create or replace view vt1 as select * from t1 union select * from t2;
|
||||
select * from vt1;
|
||||
a
|
||||
1
|
||||
#
|
||||
# MDEV-14689 crash on second PS execute
|
||||
#
|
||||
create or replace table t1 (a int);
|
||||
create or replace view v1 as select * from t1;
|
||||
create or replace table t2 (b int) with system versioning;
|
||||
@ -119,6 +121,9 @@ a
|
||||
drop database test;
|
||||
create database test;
|
||||
use test;
|
||||
#
|
||||
# MDEV-15146 SQLError[4122]: View is not system versioned
|
||||
#
|
||||
create table t1 (a int) with system versioning;
|
||||
insert t1 values (1),(2);
|
||||
set @a=now(6);
|
||||
@ -133,5 +138,15 @@ a
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
|
||||
#
|
||||
# MDEV-15378 Valid query causes invalid view definition due to syntax limitation in FOR SYSTEM_TIME
|
||||
#
|
||||
create or replace table t1 (i int) with system versioning;
|
||||
select * from t1 for system_time as of now() - interval 6 second;
|
||||
i
|
||||
create or replace view v1 as select * from t1 for system_time as of date_sub(now(), interval 6 second);
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` FOR SYSTEM_TIME AS OF current_timestamp() - interval 6 second latin1 latin1_swedish_ci
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
@ -89,7 +89,9 @@ create or replace table t2 (a int);
|
||||
create or replace view vt1 as select * from t1 union select * from t2;
|
||||
select * from vt1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-14689 crash on second PS execute
|
||||
--echo #
|
||||
create or replace table t1 (a int);
|
||||
create or replace view v1 as select * from t1;
|
||||
create or replace table t2 (b int) with system versioning;
|
||||
@ -100,10 +102,9 @@ drop database test;
|
||||
create database test;
|
||||
use test;
|
||||
|
||||
#
|
||||
# MDEV-15146 SQLError[4122]: View is not system versioned
|
||||
#
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15146 SQLError[4122]: View is not system versioned
|
||||
--echo #
|
||||
create table t1 (a int) with system versioning;
|
||||
insert t1 values (1),(2);
|
||||
set @a=now(6);
|
||||
@ -112,5 +113,14 @@ delete from t1;
|
||||
select * from v1;
|
||||
select * from v1 for system_time as of @a;
|
||||
show create view v1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-15378 Valid query causes invalid view definition due to syntax limitation in FOR SYSTEM_TIME
|
||||
--echo #
|
||||
create or replace table t1 (i int) with system versioning;
|
||||
select * from t1 for system_time as of now() - interval 6 second;
|
||||
create or replace view v1 as select * from t1 for system_time as of date_sub(now(), interval 6 second);
|
||||
show create view v1;
|
||||
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
@ -9229,7 +9229,7 @@ history_point:
|
||||
{
|
||||
$$= Vers_history_point(VERS_TIMESTAMP, $1);
|
||||
}
|
||||
| opt_history_unit simple_expr
|
||||
| opt_history_unit bit_expr
|
||||
{
|
||||
$$= Vers_history_point($1, $2);
|
||||
}
|
||||
@ -9255,13 +9255,11 @@ system_time_expr:
|
||||
{
|
||||
Lex->vers_conditions.init(SYSTEM_TIME_ALL);
|
||||
}
|
||||
| FROM history_point
|
||||
TO_SYM history_point
|
||||
| FROM history_point TO_SYM history_point
|
||||
{
|
||||
Lex->vers_conditions.init(SYSTEM_TIME_FROM_TO, $2, $4);
|
||||
}
|
||||
| BETWEEN_SYM history_point
|
||||
AND_SYM history_point
|
||||
| BETWEEN_SYM history_point AND_SYM history_point
|
||||
{
|
||||
Lex->vers_conditions.init(SYSTEM_TIME_BETWEEN, $2, $4);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user