Commit fdcc9514 authored by Alexander Barkov's avatar Alexander Barkov

sql_yacc_ora.yy: mering MDEV-13384 "window" seems like a reserved column name...

sql_yacc_ora.yy: mering MDEV-13384 "window" seems like a reserved column name but it's not listed as one

Merging MDEV-13384 changes from sql_yacc.yy to sql_yacc_ora.yy
parent 023c789a
#
# MDEV-13384: "window" seems like a reserved column name but it's not listed as one
#
# Currently we allow window as an identifier, except for table aliases.
#
CREATE TABLE door (id INT, window VARCHAR(10));
SELECT id
FROM door as window;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2
SELECT id, window
FROM door;
id window
SELECT id, window
FROM door as window;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'window' at line 2
DROP TABLE door;
--echo #
--echo # MDEV-13384: "window" seems like a reserved column name but it's not listed as one
--echo #
--echo # Currently we allow window as an identifier, except for table aliases.
--echo #
CREATE TABLE door (id INT, window VARCHAR(10));
--error ER_PARSE_ERROR
SELECT id
FROM door as window;
SELECT id, window
FROM door;
--error ER_PARSE_ERROR
SELECT id, window
FROM door as window;
DROP TABLE door;
......@@ -1224,7 +1224,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> PACKAGE_SYM /* Oracle-R */
%token <kwd> RAISE_SYM /* Oracle-PLSQL-R */
%token <kwd> ROWTYPE_SYM /* Oracle-PLSQL-R */
%token <kwd> WINDOW_SYM
/*
Non-reserved keywords
......@@ -1640,6 +1639,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> WARNINGS
%token <kwd> WEEK_SYM
%token <kwd> WEIGHT_STRING_SYM
%token <kwd> WINDOW_SYM /* SQL-2003-R */
%token <kwd> WITHIN
%token <kwd> WITHOUT /* SQL-2003-R */
%token <kwd> WORK_SYM /* SQL-2003-N */
......@@ -15318,10 +15318,8 @@ ident_table_alias:
IDENT_sys
| keyword_alias
{
$$.str= thd->strmake($1.str, $1.length);
if (unlikely($$.str == NULL))
if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
$$.length= $1.length;
}
;
......
......@@ -610,7 +610,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token PACKAGE_SYM /* Oracle-R */
%token RAISE_SYM /* Oracle-PLSQL-R */
%token ROWTYPE_SYM /* Oracle-PLSQL-R */
%token WINDOW_SYM
/*
Non-reserved keywords
......@@ -1026,6 +1025,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> WARNINGS
%token <kwd> WEEK_SYM
%token <kwd> WEIGHT_STRING_SYM
%token <kwd> WINDOW_SYM /* SQL-2003-R */
%token <kwd> WITHIN
%token <kwd> WITHOUT /* SQL-2003-R */
%token <kwd> WORK_SYM /* SQL-2003-N */
......@@ -1101,8 +1101,9 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
IDENT_sys
ident
label_ident
ident_or_empty
sp_decl_ident
ident_or_empty
ident_table_alias
ident_directly_assignable
%type <lex_string_with_metadata>
......@@ -1120,6 +1121,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <kwd>
keyword keyword_sp
keyword_alias
keyword_directly_assignable
keyword_directly_not_assignable
keyword_sp_data_type
......@@ -12019,7 +12021,7 @@ table_alias:
opt_table_alias:
/* empty */ { $$=0; }
| table_alias ident
| table_alias ident_table_alias
{
$$= (LEX_CSTRING*) thd->memdup(&$2,sizeof(LEX_STRING));
if (unlikely($$ == NULL))
......@@ -14997,6 +14999,15 @@ TEXT_STRING_filesystem:
}
;
ident_table_alias:
IDENT_sys
| keyword_alias
{
if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
}
;
ident:
IDENT_sys
| keyword
......@@ -15114,14 +15125,17 @@ user: user_maybe_role
}
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword:
/* Keywords which we allow as table aliases. */
keyword_alias:
keyword_sp
| keyword_directly_assignable
| keyword_directly_not_assignable
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword: keyword_alias | WINDOW_SYM;
/*
Keywords that we allow in Oracle-style direct assignments:
xxx := 10;
......
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