diff options
17 files changed, 56 insertions, 73 deletions
diff --git a/mysql-test/suite/versioning/r/cte.result b/mysql-test/suite/versioning/r/cte.result index d03e55d2f80..5fe71901b44 100644 --- a/mysql-test/suite/versioning/r/cte.result +++ b/mysql-test/suite/versioning/r/cte.result @@ -82,13 +82,13 @@ emp_id name mgr address 2 bill 1 New York 3 kate 1 London 4 john 1 Paris -with ancestors as (select * from emp natural join addr query for system_time all) select * from ancestors; +with ancestors as (select * from emp natural join addr system_time all) select * from ancestors; emp_id name mgr address 1 bill 0 Moscow 2 bill 1 New York 3 kate 1 London 4 john 1 Paris -select * from emp natural join addr query for system_time all; +select * from emp natural join addr system_time all; emp_id name mgr address 1 bill 0 Moscow 2 bill 1 New York diff --git a/mysql-test/suite/versioning/r/derived.result b/mysql-test/suite/versioning/r/derived.result index 06bdf9799dd..96e8c0afa55 100644 --- a/mysql-test/suite/versioning/r/derived.result +++ b/mysql-test/suite/versioning/r/derived.result @@ -148,13 +148,13 @@ y x with s3 as (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) select * from s3; y x 10 1 -select * from (select *, t1.sys_trx_start from t2 for system_time as of now, t1) as s4 query for system_time as of timestamp @t0; +select * from (select *, t1.sys_trx_start from t2 for system_time as of now, t1) as s4 system_time as of timestamp @t0; y x 10 1 with s5 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s5 for system_time as of timestamp @t0; y x 10 1 -with s6 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s6 query for system_time as of timestamp @t0; +with s6 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s6 system_time as of timestamp @t0; y x 10 1 set @q= concat("create view vt1 as select * from t1 for system_time as of timestamp '", @t0, "'"); @@ -170,7 +170,7 @@ x y select * from (select *, vt1.sys_trx_end from t2, vt1) as s0; y x 10 1 -select * from (select *, vt1.sys_trx_start from t2 for system_time as of now, vt1) as s0 query for system_time as of timestamp @t0; +select * from (select *, vt1.sys_trx_start from t2 for system_time as of now, vt1) as s0 system_time as of timestamp @t0; y x 10 1 drop table t1, t2; diff --git a/mysql-test/suite/versioning/r/optimized_fields.result b/mysql-test/suite/versioning/r/optimized_fields.result index 4878f21b1f5..376eddb41b8 100644 --- a/mysql-test/suite/versioning/r/optimized_fields.result +++ b/mysql-test/suite/versioning/r/optimized_fields.result @@ -25,7 +25,7 @@ a b 3 NULL Warnings: Warning 4075 Attempt to read unversioned field `b` in historical query -select count(*) from t group by b query for system_time as of timestamp now(6); +select count(*) from t group by b system_time as of timestamp now(6); count(*) 2 Warnings: @@ -42,29 +42,29 @@ a b 3 NULL Warnings: Warning 4075 Attempt to read unversioned field `b` in historical query -select * from t group by a having a=2 query for system_time as of timestamp now(6); +select * from t group by a having a=2 system_time as of timestamp now(6); a b Warnings: Warning 4075 Attempt to read unversioned field `b` in historical query -select * from t group by b having b=2 query for system_time as of timestamp now(6); +select * from t group by b having b=2 system_time as of timestamp now(6); a b Warnings: Warning 4075 Attempt to read unversioned field `b` in historical query -select a from t where b=2 query for system_time as of timestamp now(6); +select a from t where b=2 system_time as of timestamp now(6); a Warnings: Warning 4075 Attempt to read unversioned field `b` in historical query -select a from t where b=NULL query for system_time as of timestamp now(6); +select a from t where b=NULL system_time as of timestamp now(6); a Warnings: Warning 4075 Attempt to read unversioned field `b` in historical query -select a from t where b is NULL query for system_time as of timestamp now(6); +select a from t where b is NULL system_time as of timestamp now(6); a 1 3 Warnings: Warning 4075 Attempt to read unversioned field `b` in historical query -select count(*), b from t group by b having b=NULL query for system_time as of timestamp now(6); +select count(*), b from t group by b having b=NULL system_time as of timestamp now(6); count(*) b Warnings: Warning 4075 Attempt to read unversioned field `b` in historical query diff --git a/mysql-test/suite/versioning/r/select.result b/mysql-test/suite/versioning/r/select.result index 39a5880250a..8a22b26fad1 100644 --- a/mysql-test/suite/versioning/r/select.result +++ b/mysql-test/suite/versioning/r/select.result @@ -146,11 +146,11 @@ select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 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 -query for system_time as of timestamp @t0; +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 -query for system_time as of timestamp @t0; +system_time as of timestamp @t0; select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x -query for system_time as of timestamp @t0; +system_time as of timestamp @t0; drop table t1; drop table t2; end~~ @@ -333,7 +333,7 @@ A create or replace table t1 (x int); insert into t1 values (1); select * from t1 for system_time all; -ERROR HY000: System Versioning required: `FOR SYSTEM_TIME` query +ERROR HY000: System Versioning required: t1 create or replace table t1 (x int) with system versioning; insert into t1 values (1); select * from t1 for system_time all for update; @@ -431,13 +431,13 @@ create or replace table t2 (y int) with system versioning; insert into t1 values (1), (2), (3); delete from t1 where x = 3; insert into t2 values (1); -select * from t1, t2 query for system_time all; +select * from t1, t2 system_time all; x y 1 1 2 1 3 1 -select * from t1 for system_time all, t2 for system_time all query for system_time all; -ERROR HY000: Unused clause: 'QUERY FOR SYSTEM_TIME' +select * from t1 for system_time all, t2 for system_time all system_time all; +ERROR HY000: Unused clause: 'SYSTEM_TIME' drop view v1; drop table t1, t2; call innodb_verify_vtq(27); diff --git a/mysql-test/suite/versioning/r/simple.result b/mysql-test/suite/versioning/r/simple.result index 9454d487293..e0af556f073 100644 --- a/mysql-test/suite/versioning/r/simple.result +++ b/mysql-test/suite/versioning/r/simple.result @@ -44,28 +44,28 @@ emp_id dept_id name salary dept_id name select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time from timestamp @ts_1 to timestamp @ts_2; +system_time from timestamp @ts_1 to timestamp @ts_2; emp_id dept_id name salary sys_trx_start sys_trx_end dept_id name sys_trx_start sys_trx_end select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time as of timestamp @ts_0; +system_time as of timestamp @ts_0; emp_id dept_id name salary dept_id name select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time as of timestamp @ts_1; +system_time as of timestamp @ts_1; emp_id dept_id name salary dept_id name select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time as of timestamp @ts_2; +system_time as of timestamp @ts_2; emp_id dept_id name salary dept_id name 1 10 bill 1000 10 accounting select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time as of timestamp @ts_3; +system_time as of timestamp @ts_3; emp_id dept_id name salary dept_id name 1 10 bill 2000 10 accounting drop table emp, dept; diff --git a/mysql-test/suite/versioning/r/truncate_history.result b/mysql-test/suite/versioning/r/truncate.result index e0bf8816483..1ad9090f644 100644 --- a/mysql-test/suite/versioning/r/truncate_history.result +++ b/mysql-test/suite/versioning/r/truncate.result @@ -1,6 +1,6 @@ create table t (a int); truncate t for system_time all; -ERROR HY000: System Versioning required: `FOR SYSTEM_TIME` query +ERROR HY000: Unused clause: 'SYSTEM_TIME' create procedure truncate_history_of_t() begin prepare stmt from 'truncate t for system_time timestamp between \'1-1-1\' and now(6)'; diff --git a/mysql-test/suite/versioning/t/cte.test b/mysql-test/suite/versioning/t/cte.test index 2650590b552..22c72bd9ed1 100644 --- a/mysql-test/suite/versioning/t/cte.test +++ b/mysql-test/suite/versioning/t/cte.test @@ -76,8 +76,8 @@ insert emp values (4, 'john', 1); insert addr values (4, 'Paris'); with ancestors as (select * from emp natural join addr) select * from ancestors; with ancestors as (select * from emp natural join addr) select * from ancestors for system_time all; -with ancestors as (select * from emp natural join addr query for system_time all) select * from ancestors; -select * from emp natural join addr query for system_time all; +with ancestors as (select * from emp natural join addr system_time all) select * from ancestors; +select * from emp natural join addr system_time all; drop table emp; drop table dept; diff --git a/mysql-test/suite/versioning/t/derived.test b/mysql-test/suite/versioning/t/derived.test index f4de94f2f27..d8b37298210 100644 --- a/mysql-test/suite/versioning/t/derived.test +++ b/mysql-test/suite/versioning/t/derived.test @@ -108,9 +108,9 @@ with s1 as (select * from t1 for system_time as of timestamp @t0, t2) select * f select * from (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) as s2; with s3 as (select *, t1.sys_trx_end from t2, t1 for system_time as of timestamp @t0) select * from s3; # system_time propagation from outer to inner -select * from (select *, t1.sys_trx_start from t2 for system_time as of now, t1) as s4 query for system_time as of timestamp @t0; +select * from (select *, t1.sys_trx_start from t2 for system_time as of now, t1) as s4 system_time as of timestamp @t0; with s5 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s5 for system_time as of timestamp @t0; -with s6 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s6 query for system_time as of timestamp @t0; +with s6 as (select *, t1.sys_trx_start from t2 for system_time as of now, t1) select * from s6 system_time as of timestamp @t0; # VIEW instead of t1 set @q= concat("create view vt1 as select * from t1 for system_time as of timestamp '", @t0, "'"); @@ -123,7 +123,7 @@ select * from (select * from vt1, t2) as s0; # leading table selection select * from (select *, vt1.sys_trx_end from t2, vt1) as s0; # system_time propagation from outer to inner -select * from (select *, vt1.sys_trx_start from t2 for system_time as of now, vt1) as s0 query for system_time as of timestamp @t0; +select * from (select *, vt1.sys_trx_start from t2 for system_time as of now, vt1) as s0 system_time as of timestamp @t0; drop table t1, t2; drop view vt1; diff --git a/mysql-test/suite/versioning/t/optimized_fields.test b/mysql-test/suite/versioning/t/optimized_fields.test index d1490d893a4..321fe6d104d 100644 --- a/mysql-test/suite/versioning/t/optimized_fields.test +++ b/mysql-test/suite/versioning/t/optimized_fields.test @@ -9,15 +9,15 @@ select * from t; select a from t for system_time as of timestamp now(6); select a, b, b+0 from t for system_time as of timestamp now(6); select * from t for system_time as of timestamp now(6); -select count(*) from t group by b query for system_time as of timestamp now(6); +select count(*) from t group by b system_time as of timestamp now(6); select * from t for system_time as of timestamp now(6) order by b asc; select * from t for system_time as of timestamp now(6) order by b desc; -select * from t group by a having a=2 query for system_time as of timestamp now(6); -select * from t group by b having b=2 query for system_time as of timestamp now(6); -select a from t where b=2 query for system_time as of timestamp now(6); -select a from t where b=NULL query for system_time as of timestamp now(6); -select a from t where b is NULL query for system_time as of timestamp now(6); -select count(*), b from t group by b having b=NULL query for system_time as of timestamp now(6); +select * from t group by a having a=2 system_time as of timestamp now(6); +select * from t group by b having b=2 system_time as of timestamp now(6); +select a from t where b=2 system_time as of timestamp now(6); +select a from t where b=NULL system_time as of timestamp now(6); +select a from t where b is NULL system_time as of timestamp now(6); +select count(*), b from t group by b having b=NULL system_time as of timestamp now(6); select a, b from t; drop table t; diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test index ca8b9ccf56a..ef8dcb85664 100644 --- a/mysql-test/suite/versioning/t/select.test +++ b/mysql-test/suite/versioning/t/select.test @@ -99,11 +99,11 @@ begin 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 - query for system_time as of timestamp @t0; + 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 - query for system_time as of timestamp @t0; + system_time as of timestamp @t0; select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x - query for system_time as of timestamp @t0; + system_time as of timestamp @t0; drop table t1; drop table t2; @@ -195,10 +195,10 @@ create or replace table t2 (y int) with system versioning; insert into t1 values (1), (2), (3); delete from t1 where x = 3; insert into t2 values (1); -select * from t1, t2 query for system_time all; +select * from t1, t2 system_time all; --error ER_VERS_UNUSED_CLAUSE -select * from t1 for system_time all, t2 for system_time all query for system_time all; +select * from t1 for system_time all, t2 for system_time all system_time all; drop view v1; drop table t1, t2; diff --git a/mysql-test/suite/versioning/t/simple.test b/mysql-test/suite/versioning/t/simple.test index bb540f05c26..d32ea939279 100644 --- a/mysql-test/suite/versioning/t/simple.test +++ b/mysql-test/suite/versioning/t/simple.test @@ -45,26 +45,26 @@ where d.dept_id = 10 select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time from timestamp @ts_1 to timestamp @ts_2; +system_time from timestamp @ts_1 to timestamp @ts_2; select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time as of timestamp @ts_0; +system_time as of timestamp @ts_0; select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time as of timestamp @ts_1; +system_time as of timestamp @ts_1; select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time as of timestamp @ts_2; +system_time as of timestamp @ts_2; select * from emp e, dept d where d.dept_id = 10 and d.dept_id = e.dept_id -query for system_time as of timestamp @ts_3; +system_time as of timestamp @ts_3; drop table emp, dept; diff --git a/mysql-test/suite/versioning/t/truncate_history.opt b/mysql-test/suite/versioning/t/truncate.opt index c1a585b67eb..c1a585b67eb 100644 --- a/mysql-test/suite/versioning/t/truncate_history.opt +++ b/mysql-test/suite/versioning/t/truncate.opt diff --git a/mysql-test/suite/versioning/t/truncate_history.test b/mysql-test/suite/versioning/t/truncate.test index a512c432651..7bf5c59acf8 100644 --- a/mysql-test/suite/versioning/t/truncate_history.test +++ b/mysql-test/suite/versioning/t/truncate.test @@ -1,7 +1,7 @@ -- source include/have_innodb.inc create table t (a int); ---error ER_VERSIONING_REQUIRED +--error ER_VERS_UNUSED_CLAUSE truncate t for system_time all; delimiter ~~; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 067b78e3a05..589d02fb55b 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1368,21 +1368,6 @@ int MYSQLlex(YYSTYPE *yylval, THD *thd) return FOR_SYM; } break; - case QUERY_SYM: - { - CHARSET_INFO *cs= thd->charset(); - const char *p= lip->get_ptr(); - while (my_isspace(cs, *p)) - ++p; - if (lip->get_end_of_query() - p > 3 && my_isspace(cs, p[3]) && - 0 == strncasecmp(p, "for", 3)) - { - token= lex_one_token(yylval, thd); - lip->add_digest_token(token, yylval); - return QUERY_FOR_SYM; - } - return QUERY_SYM; - } default: break; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ff3ce427ef5..2ae574398fc 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -708,7 +708,7 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr, versioned_tables++; else if (table->vers_conditions) { - my_error(ER_VERSIONING_REQUIRED, MYF(0), "`FOR SYSTEM_TIME` query"); + my_error(ER_VERSIONING_REQUIRED, MYF(0), table->alias); DBUG_RETURN(-1); } } @@ -717,7 +717,7 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr, { if (slex->vers_conditions) { - my_error(ER_VERSIONING_REQUIRED, MYF(0), "`FOR SYSTEM_TIME` query"); + my_error(ER_VERS_UNUSED_CLAUSE, MYF(0), "SYSTEM_TIME"); DBUG_RETURN(-1); } DBUG_RETURN(0); @@ -1014,7 +1014,7 @@ int vers_setup_select(THD *thd, TABLE_LIST *tables, COND **where_expr, if (!slex->vers_conditions.used && slex->vers_conditions) { - my_error(ER_VERS_UNUSED_CLAUSE, MYF(0), "QUERY FOR SYSTEM_TIME"); + my_error(ER_VERS_UNUSED_CLAUSE, MYF(0), "SYSTEM_TIME"); DBUG_RETURN(-1); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b0365d2b97f..27705f6bd41 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1355,7 +1355,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token PURGE %token QUARTER_SYM %token QUERY_SYM -%token QUERY_FOR_SYM /* INTERNAL */ %token QUICK %token RAISE_SYM /* Oracle-PLSQL-R */ %token RANGE_SYM /* SQL-2003-R */ @@ -8804,7 +8803,7 @@ table_expression: opt_group_clause opt_having_clause opt_window_clause - opt_query_for_system_time_clause + opt_system_time_clause ; opt_table_expression: @@ -8850,10 +8849,10 @@ trans_or_timestamp: } ; -opt_query_for_system_time_clause: +opt_system_time_clause: /* empty */ {} - | QUERY_FOR_SYM SYSTEM_TIME_SYM for_system_time_expr + | SYSTEM_TIME_SYM system_time_expr { DBUG_ASSERT(Select); Select->vers_conditions= Lex->vers_conditions; @@ -8865,13 +8864,13 @@ opt_for_system_time_clause: { $$= false; } - | FOR_SYSTEM_TIME_SYM for_system_time_expr + | FOR_SYSTEM_TIME_SYM system_time_expr { $$= true; } ; -for_system_time_expr: +system_time_expr: AS OF_SYM trans_or_timestamp simple_expr { Lex->vers_conditions.init(FOR_SYSTEM_TIME_AS_OF, $3, $4); diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index f989e3b93ff..d7403228831 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -763,7 +763,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token PURGE %token QUARTER_SYM %token QUERY_SYM -%token QUERY_FOR_SYM /* INTERNAL */ %token QUICK %token RAISE_SYM /* Oracle-PLSQL-R */ %token RANGE_SYM /* SQL-2003-R */ |