MDEV-9979 Keywords UNBOUNDED, PRECEDING, FOLLOWING, TIES, OTHERS should be non-reserved

Adding keywords the following keywords into the "keyword" rules:
- EXCLUDE
- UNBOUNDED
- PRECEDING
- FOLLOWING
- TIES
- OTHERS

They are non-reserved words in the SQL standard (checked in a SQL-2011 draft),
and they don't cause any conflicts in sql_yacc.yy.
This commit is contained in:
Alexander Barkov 2017-01-31 23:41:10 +04:00
parent 642077ea5a
commit 1d96b09890
3 changed files with 104 additions and 6 deletions

View file

@ -276,6 +276,57 @@ ERROR HY000: Unknown system variable 'option'
set option option=1;
ERROR HY000: Unknown system variable 'option'
#
# MDEV-9979 Keywords UNBOUNDED, PRECEDING, FOLLOWING, TIES, OTHERS should be non-reserved
#
CREATE TABLE EXCLUDE (EXCLUDE INT);
SELECT EXCLUDE FROM EXCLUDE;
EXCLUDE
SELECT EXCLUDE EXCLUDE FROM EXCLUDE;
EXCLUDE
SELECT EXCLUDE AS EXCLUDE FROM EXCLUDE;
EXCLUDE
DROP TABLE EXCLUDE;
CREATE TABLE UNBOUNDED (UNBOUNDED INT);
SELECT UNBOUNDED FROM UNBOUNDED;
UNBOUNDED
SELECT UNBOUNDED UNBOUNDEX FROM UNBOUNDED;
UNBOUNDEX
SELECT UNBOUNDED AS UNBOUNDEX FROM UNBOUNDED;
UNBOUNDEX
DROP TABLE UNBOUNDED;
CREATE TABLE PRECEDING (PRECEDING INT);
SELECT PRECEDING FROM PRECEDING;
PRECEDING
SELECT PRECEDING PRECEDING FROM PRECEDING;
PRECEDING
SELECT PRECEDING AS PRECEDING FROM PRECEDING;
PRECEDING
DROP TABLE PRECEDING;
CREATE TABLE FOLLOWING (FOLLOWING INT);
SELECT FOLLOWING FROM FOLLOWING;
FOLLOWING
SELECT FOLLOWING FOLLOWING FROM FOLLOWING;
FOLLOWING
SELECT FOLLOWING AS FOLLOWING FROM FOLLOWING;
FOLLOWING
DROP TABLE FOLLOWING;
CREATE TABLE TIES (TIES INT);
SELECT TIES FROM TIES;
TIES
SELECT TIES TIES FROM TIES;
TIES
SELECT TIES AS TIES FROM TIES;
TIES
DROP TABLE TIES;
CREATE TABLE OTHERS (OTHERS INT);
SELECT OTHERS FROM OTHERS;
OTHERS
SELECT OTHERS OTHERS FROM OTHERS;
OTHERS
SELECT OTHERS AS OTHERS FROM OTHERS;
OTHERS
DROP TABLE OTHERS;
#
# MDEV-10585 EXECUTE IMMEDIATE statement
#
CREATE TABLE immediate (immediate int);

View file

@ -174,6 +174,46 @@ set option=1;
--error 1193
set option option=1;
--echo #
--echo # MDEV-9979 Keywords UNBOUNDED, PRECEDING, FOLLOWING, TIES, OTHERS should be non-reserved
--echo #
CREATE TABLE EXCLUDE (EXCLUDE INT);
SELECT EXCLUDE FROM EXCLUDE;
SELECT EXCLUDE EXCLUDE FROM EXCLUDE;
SELECT EXCLUDE AS EXCLUDE FROM EXCLUDE;
DROP TABLE EXCLUDE;
CREATE TABLE UNBOUNDED (UNBOUNDED INT);
SELECT UNBOUNDED FROM UNBOUNDED;
SELECT UNBOUNDED UNBOUNDEX FROM UNBOUNDED;
SELECT UNBOUNDED AS UNBOUNDEX FROM UNBOUNDED;
DROP TABLE UNBOUNDED;
CREATE TABLE PRECEDING (PRECEDING INT);
SELECT PRECEDING FROM PRECEDING;
SELECT PRECEDING PRECEDING FROM PRECEDING;
SELECT PRECEDING AS PRECEDING FROM PRECEDING;
DROP TABLE PRECEDING;
CREATE TABLE FOLLOWING (FOLLOWING INT);
SELECT FOLLOWING FROM FOLLOWING;
SELECT FOLLOWING FOLLOWING FROM FOLLOWING;
SELECT FOLLOWING AS FOLLOWING FROM FOLLOWING;
DROP TABLE FOLLOWING;
CREATE TABLE TIES (TIES INT);
SELECT TIES FROM TIES;
SELECT TIES TIES FROM TIES;
SELECT TIES AS TIES FROM TIES;
DROP TABLE TIES;
CREATE TABLE OTHERS (OTHERS INT);
SELECT OTHERS FROM OTHERS;
SELECT OTHERS OTHERS FROM OTHERS;
SELECT OTHERS AS OTHERS FROM OTHERS;
DROP TABLE OTHERS;
--echo #
--echo # MDEV-10585 EXECUTE IMMEDIATE statement
--echo #

View file

@ -1030,6 +1030,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
Comments for TOKENS.
For each token, please include in the same line a comment that contains
the following tags:
SQL-2011-N : Non Reserved keywird as per SQL-2011
SQL-2003-R : Reserved keyword as per SQL-2003
SQL-2003-N : Non Reserved keyword as per SQL-2003
SQL-1999-R : Reserved keyword as per SQL-1999
@ -1219,7 +1220,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token EVERY_SYM /* SQL-2003-N */
%token EXCHANGE_SYM
%token EXAMINED_SYM
%token EXCLUDE_SYM
%token EXCLUDE_SYM /* SQL-2011-N */
%token EXECUTE_SYM /* SQL-2003-R */
%token EXISTS /* SQL-2003-R */
%token EXIT_SYM
@ -1240,7 +1241,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token FLOAT_SYM /* SQL-2003-R */
%token FLUSH_SYM
%token FOLLOWS_SYM /* MYSQL trigger*/
%token FOLLOWING_SYM
%token FOLLOWING_SYM /* SQL-2011-N */
%token FORCE_SYM
%token FOREIGN /* SQL-2003-R */
%token FOR_SYM /* SQL-2003-R */
@ -1442,7 +1443,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token ORDER_SYM /* SQL-2003-R */
%token OR_OR_SYM /* OPERATOR */
%token OR_SYM /* SQL-2003-R */
%token OTHERS_SYM
%token OTHERS_SYM /* SQL-2011-N */
%token OUTER
%token OUTFILE
%token OUT_SYM /* SQL-2003-R */
@ -1469,7 +1470,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token PORT_SYM
%token POSITION_SYM /* SQL-2003-N */
%token PRECEDES_SYM /* MYSQL */
%token PRECEDING_SYM
%token PRECEDING_SYM /* SQL-2011-N */
%token PRECISION /* SQL-2003-R */
%token PREPARE_SYM /* SQL-2003-R */
%token PRESERVE_SYM
@ -1630,7 +1631,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token TEXT_SYM
%token THAN_SYM
%token THEN_SYM /* SQL-2003-R */
%token TIES_SYM
%token TIES_SYM /* SQL-2011-N */
%token TIMESTAMP /* SQL-2003-R */
%token TIMESTAMP_ADD
%token TIMESTAMP_DIFF
@ -1651,7 +1652,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token TYPE_SYM /* SQL-2003-N */
%token UDF_RETURNS_SYM
%token ULONGLONG_NUM
%token UNBOUNDED_SYM
%token UNBOUNDED_SYM /* SQL-2011-N */
%token UNCOMMITTED_SYM /* SQL-2003-N */
%token UNDEFINED_SYM
%token UNDERSCORE_CHARSET
@ -14539,9 +14540,11 @@ keyword:
| DO_SYM {}
| END {}
| EXAMINED_SYM {}
| EXCLUDE_SYM {}
| EXECUTE_SYM {}
| FLUSH_SYM {}
| FOLLOWS_SYM {}
| FOLLOWING_SYM {}
| FORMAT_SYM {}
| GET_SYM {}
| HANDLER_SYM {}
@ -14553,10 +14556,12 @@ keyword:
| OPEN_SYM {}
| OPTION {}
| OPTIONS_SYM {}
| OTHERS_SYM {}
| OWNER_SYM {}
| PARSER_SYM {}
| PORT_SYM {}
| PRECEDES_SYM {}
| PRECEDING_SYM {}
| PREPARE_SYM {}
| REMOVE_SYM {}
| REPAIR {}
@ -14575,9 +14580,11 @@ keyword:
| START_SYM {}
| STOP_SYM {}
| STORED_SYM {}
| TIES_SYM {}
| TRUNCATE_SYM {}
| UNICODE_SYM {}
| UNINSTALL_SYM {}
| UNBOUNDED_SYM {}
| WRAPPER_SYM {}
| XA_SYM {}
| UPGRADE_SYM {}