Commit 611488e3 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-16244 sql_mode=ORACLE: Some keywords do not work in variable declarations

1. Adding LEX::make_item_sysvar() and reusing it
   in sql_yacc.yy and sql_yacc_ora.yy.
   Removing the "opt_component" rule.

2. Renaming rules to better reflect their purpose:
   - keyword to keyword_ident
   - keyword_sp to keyword_label
   - keyword_sp_not_data_type to keyword_sp_var_and_label

   Also renaming:
   - sp_decl_ident_keyword to keyword_sp_decl for naming consistency
   - keyword_alias to keyword_table_alias,
     for consistency with ident_table_alias
   - keyword_sp_data_type to keyword_data_type,
     as it has nothing SP-specific.

3. Moving GLOBAL_SYM, LOCAL_SYM, SESSION_SYM from
   keyword_sp_var_and_label to a separate rule keyword_sysvar_type.
   We don't have system variables with these names anyway.
   Adding ident_sysvar_name and using it in the grammar that needs
   a system variable name instead of ident_or_text.
   This removed a number of shift/reduce conflicts
   between GLOBAL_SYM/LOCAL_SYM/SESSION_SYM as a variable scope and
   as a variable name.

4. Moving keywords BEGIN_SYM, END (in both *.yy fiels)
   and EXCEPTION_SYM (in sql_yacc_ora.yy) into a separate
   rule keyword_sp_block_section, because in Oracle verb keywords
   (COMMIT, DO, HANDLER, OPEN, REPAIR, ROLLBACK, SAVEPOINT, SHUTDOWN, TRUNCATE)
   are good variables names and can appear in e.g. DECLARE,
   while block keywords (BEGIN, END, EXCEPTION) are not good variable names
   and cannot appear in DECLARE.

5. Further splitting keyword_directly_not_assignable in sql_yacc_ora.yy:
   moving keyword_sp_verb_clause out. Renaming the rest of
   keyword_directly_not_assignable to keyword_sp_head,
   which represents keywords that can appear in optional
   clauses in CREATE PROCEDURE/FUNCTION/TRIGGER.

6. Renaming keyword_sp_verb_clause to keyword_verb_clause,
   as now it does not contains anything SP-specific.

   As a result or #4,#5,#6, the rule keyword_directly_not_assignable
   was replaced to three separate rules:
   - keyword_sp_block
   - keyword_sp_head
   - keyword_verb_clause
   Adding the same rules in sql_yacc.yy, for unification.

6. Adding keyword_sp_head and keyword_verb_clause into keyword_sp_decl.
   This fixes MDEV-16244.

7. Reorganizing the rest of keyword related rules into two groups:
  a. Rules defining a list of keywords and consisting of only terminal symbols:
    - keyword_sp_var_not_label
    - keyword_sp_head
    - keyword_sp_verb_clause
    - keyword_sp_block_section
    - keyword_sysvar_type

  b. Rules that combine the above lists into keyword places:
    - keyword_table_alias
    - keyword_ident
    - keyword_label
    - keyword_sysvar_name
    - keyword_sp_decl
  Rules from the group "b" use on the right side only rules
  from the group "a" (with optional terminal symbols added).
  Rules from the group "b" DO NOT mutually use each other any more.
  This makes them easier to read (and see the difference between them).

  Sorting the right sides of the group "b" keyword rules alphabetically,
  for yet better readability.
parent d6976a7e
...@@ -348,3 +348,103 @@ SELECT without VERSIONING FROM t1 ...@@ -348,3 +348,103 @@ SELECT without VERSIONING FROM t1
SELECT without WITHOUT FROM t1 SELECT without WITHOUT FROM t1
DROP PROCEDURE p2; DROP PROCEDURE p2;
DROP PROCEDURE p1; DROP PROCEDURE p1;
#
# MDEV-16244 sql_mode=ORACLE: Some keywords do not work in variable declarations
#
SET sql_mode=ORACLE;
DECLARE
do INT;
BEGIN
SELECT do INTO do FROM DUAL;
END;
/
DECLARE
handler INT;
BEGIN
SELECT handler INTO handler FROM DUAL;
END;
/
DECLARE
repair INT;
BEGIN
SELECT repair INTO repair FROM DUAL;
END;
/
DECLARE
shutdown INT;
BEGIN
SELECT shutdown INTO shutdown FROM DUAL;
END;
/
DECLARE
truncate INT;
BEGIN
SELECT truncate INTO truncate FROM DUAL;
END;
/
DECLARE
close INT;
BEGIN
SELECT close INTO close FROM DUAL;
END;
/
DECLARE
commit INT;
BEGIN
SELECT commit INTO commit FROM DUAL;
END;
/
DECLARE
open INT;
BEGIN
SELECT open INTO open FROM DUAL;
END;
/
DECLARE
rollback INT;
BEGIN
SELECT rollback INTO rollback FROM DUAL;
END;
/
DECLARE
savepoint INT;
BEGIN
SELECT savepoint INTO savepoint FROM DUAL;
END;
/
DECLARE
contains INT;
BEGIN
SELECT contains INTO contains FROM DUAL;
END;
/
DECLARE
language INT;
BEGIN
SELECT language INTO language FROM DUAL;
END;
/
DECLARE
no INT;
BEGIN
SELECT no INTO no FROM DUAL;
END;
/
DECLARE
charset INT;
BEGIN
SELECT charset INTO charset FROM DUAL;
END;
/
DECLARE
follows INT;
BEGIN
SELECT follows INTO follows FROM DUAL;
END;
/
DECLARE
precedes INT;
BEGIN
SELECT precedes INTO precedes FROM DUAL;
END;
/
...@@ -87,3 +87,124 @@ CALL p2('without'); ...@@ -87,3 +87,124 @@ CALL p2('without');
DROP PROCEDURE p2; DROP PROCEDURE p2;
DROP PROCEDURE p1; DROP PROCEDURE p1;
--echo #
--echo # MDEV-16244 sql_mode=ORACLE: Some keywords do not work in variable declarations
--echo #
SET sql_mode=ORACLE;
DELIMITER /;
DECLARE
do INT;
BEGIN
SELECT do INTO do FROM DUAL;
END;
/
DECLARE
handler INT;
BEGIN
SELECT handler INTO handler FROM DUAL;
END;
/
DECLARE
repair INT;
BEGIN
SELECT repair INTO repair FROM DUAL;
END;
/
DECLARE
shutdown INT;
BEGIN
SELECT shutdown INTO shutdown FROM DUAL;
END;
/
DECLARE
truncate INT;
BEGIN
SELECT truncate INTO truncate FROM DUAL;
END;
/
DECLARE
close INT;
BEGIN
SELECT close INTO close FROM DUAL;
END;
/
DECLARE
commit INT;
BEGIN
SELECT commit INTO commit FROM DUAL;
END;
/
DECLARE
open INT;
BEGIN
SELECT open INTO open FROM DUAL;
END;
/
DECLARE
rollback INT;
BEGIN
SELECT rollback INTO rollback FROM DUAL;
END;
/
DECLARE
savepoint INT;
BEGIN
SELECT savepoint INTO savepoint FROM DUAL;
END;
/
DECLARE
contains INT;
BEGIN
SELECT contains INTO contains FROM DUAL;
END;
/
DECLARE
language INT;
BEGIN
SELECT language INTO language FROM DUAL;
END;
/
DECLARE
no INT;
BEGIN
SELECT no INTO no FROM DUAL;
END;
/
DECLARE
charset INT;
BEGIN
SELECT charset INTO charset FROM DUAL;
END;
/
DECLARE
follows INT;
BEGIN
SELECT follows INTO follows FROM DUAL;
END;
/
DECLARE
precedes INT;
BEGIN
SELECT precedes INTO precedes FROM DUAL;
END;
/
DELIMITER ;/
...@@ -6626,6 +6626,31 @@ Item *LEX::make_item_colon_ident_ident(THD *thd, ...@@ -6626,6 +6626,31 @@ Item *LEX::make_item_colon_ident_ident(THD *thd,
} }
Item *LEX::make_item_sysvar(THD *thd,
enum_var_type type,
const LEX_CSTRING *name,
const LEX_CSTRING *component)
{
Item *item;
DBUG_ASSERT(name->str);
/*
"SELECT @@global.global.variable" is not allowed
Note, "global" can come through TEXT_STRING_sys.
*/
if (component->str && unlikely(check_reserved_words(name)))
{
thd->parse_error();
return NULL;
}
if (unlikely(!(item= get_system_var(thd, type, name, component))))
return NULL;
if (!((Item_func_get_system_var*) item)->is_written_to_binlog())
set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_VARIABLE);
return item;
}
Item_param *LEX::add_placeholder(THD *thd, const LEX_CSTRING *name, Item_param *LEX::add_placeholder(THD *thd, const LEX_CSTRING *name,
const char *start, const char *end) const char *start, const char *end)
{ {
......
...@@ -3630,6 +3630,17 @@ struct LEX: public Query_tables_list ...@@ -3630,6 +3630,17 @@ struct LEX: public Query_tables_list
Item *make_item_colon_ident_ident(THD *thd, Item *make_item_colon_ident_ident(THD *thd,
const Lex_ident_cli_st *a, const Lex_ident_cli_st *a,
const Lex_ident_cli_st *b); const Lex_ident_cli_st *b);
// For "SELECT @@var", "SELECT @@var.field"
Item *make_item_sysvar(THD *thd,
enum_var_type type,
const LEX_CSTRING *name)
{
return make_item_sysvar(thd, type, name, &null_clex_str);
}
Item *make_item_sysvar(THD *thd,
enum_var_type type,
const LEX_CSTRING *name,
const LEX_CSTRING *component);
void sp_block_init(THD *thd, const LEX_CSTRING *label); void sp_block_init(THD *thd, const LEX_CSTRING *label);
void sp_block_init(THD *thd) void sp_block_init(THD *thd)
{ {
......
...@@ -888,10 +888,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -888,10 +888,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd } %parse-param { THD *thd }
%lex-param { THD *thd } %lex-param { THD *thd }
/* /*
Currently there are 68 shift/reduce conflicts. Currently there are 62 shift/reduce conflicts.
We should not introduce new conflicts any more. We should not introduce new conflicts any more.
*/ */
%expect 68 %expect 62
/* /*
Comments for TOKENS. Comments for TOKENS.
...@@ -1244,7 +1244,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1244,7 +1244,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> AVG_ROW_LENGTH %token <kwd> AVG_ROW_LENGTH
%token <kwd> AVG_SYM /* SQL-2003-N */ %token <kwd> AVG_SYM /* SQL-2003-N */
%token <kwd> BACKUP_SYM %token <kwd> BACKUP_SYM
%token <kwd> BEGIN_SYM /* SQL-2003-R */ %token <kwd> BEGIN_SYM /* SQL-2003-R, PLSQL-R */
%token <kwd> BINLOG_SYM %token <kwd> BINLOG_SYM
%token <kwd> BIT_SYM /* MYSQL-FUNC */ %token <kwd> BIT_SYM /* MYSQL-FUNC */
%token <kwd> BLOCK_SYM %token <kwd> BLOCK_SYM
...@@ -1318,7 +1318,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1318,7 +1318,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> DUPLICATE_SYM %token <kwd> DUPLICATE_SYM
%token <kwd> DYNAMIC_SYM /* SQL-2003-R */ %token <kwd> DYNAMIC_SYM /* SQL-2003-R */
%token <kwd> ENABLE_SYM %token <kwd> ENABLE_SYM
%token <kwd> END /* SQL-2003-R */ %token <kwd> END /* SQL-2003-R, PLSQL-R */
%token <kwd> ENDS_SYM %token <kwd> ENDS_SYM
%token <kwd> ENGINES_SYM %token <kwd> ENGINES_SYM
%token <kwd> ENGINE_SYM %token <kwd> ENGINE_SYM
...@@ -1762,7 +1762,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1762,7 +1762,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
HEX_NUM HEX_STRING HEX_NUM HEX_STRING
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident_or_text LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident_or_text
TEXT_STRING_sys TEXT_STRING_literal TEXT_STRING_sys TEXT_STRING_literal
opt_component key_cache_name key_cache_name
sp_opt_label BIN_NUM TEXT_STRING_filesystem sp_opt_label BIN_NUM TEXT_STRING_filesystem
opt_constraint constraint opt_ident opt_constraint constraint opt_ident
sp_block_label opt_place opt_db sp_block_label opt_place opt_db
...@@ -1777,6 +1777,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1777,6 +1777,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
sp_decl_ident sp_decl_ident
ident_or_empty ident_or_empty
ident_table_alias ident_table_alias
ident_sysvar_name
%type <lex_string_with_metadata> %type <lex_string_with_metadata>
TEXT_STRING TEXT_STRING
...@@ -1792,11 +1793,18 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1792,11 +1793,18 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ident_cli ident_cli
%type <kwd> %type <kwd>
keyword keyword_sp keyword_data_type
keyword_alias keyword_ident
keyword_sp_data_type keyword_label
keyword_sp_not_data_type keyword_sp_block_section
keyword_sp_verb_clause keyword_sp_decl
keyword_sp_head
keyword_sp_var_and_label
keyword_sp_var_not_label
keyword_sysvar_name
keyword_sysvar_type
keyword_table_alias
keyword_verb_clause
%type <table> %type <table>
table_ident table_ident_nodb references xid table_ident table_ident_nodb references xid
...@@ -4004,7 +4012,12 @@ condition_information_item_name: ...@@ -4004,7 +4012,12 @@ condition_information_item_name:
; ;
sp_decl_ident: sp_decl_ident:
ident IDENT_sys
| keyword_sp_decl
{
if (unlikely($$.copy_ident_cli(thd, &$1)))
MYSQL_YYABORT;
}
; ;
sp_decl_idents: sp_decl_idents:
...@@ -7632,11 +7645,6 @@ opt_ident: ...@@ -7632,11 +7645,6 @@ opt_ident:
| field_ident { $$= $1; } | field_ident { $$= $1; }
; ;
opt_component:
/* empty */ { $$= null_clex_str; }
| '.' ident { $$= $2; }
;
string_list: string_list:
text_string text_string
{ Lex->last_field->interval_list.push_back($1, thd->mem_root); } { Lex->last_field->interval_list.push_back($1, thd->mem_root); }
...@@ -11351,18 +11359,15 @@ variable_aux: ...@@ -11351,18 +11359,15 @@ variable_aux:
LEX *lex= Lex; LEX *lex= Lex;
lex->uncacheable(UNCACHEABLE_SIDEEFFECT); lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
} }
| '@' opt_var_ident_type ident_or_text opt_component | '@' opt_var_ident_type ident_sysvar_name
{ {
/* disallow "SELECT @@global.global.variable" */ if (unlikely(!($$= Lex->make_item_sysvar(thd, $2, &$3))))
if (unlikely($3.str && $4.str && check_reserved_words(&$3)))
{
thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (unlikely(!($$= get_system_var(thd, $2, &$3, &$4)))) | '@' opt_var_ident_type ident_sysvar_name '.' ident
{
if (unlikely(!($$= Lex->make_item_sysvar(thd, $2, &$3, &$5))))
MYSQL_YYABORT; MYSQL_YYABORT;
if (!((Item_func_get_system_var*) $$)->is_written_to_binlog())
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_VARIABLE);
} }
; ;
...@@ -15152,7 +15157,7 @@ IDENT_cli: ...@@ -15152,7 +15157,7 @@ IDENT_cli:
ident_cli: ident_cli:
IDENT IDENT
| IDENT_QUOTED | IDENT_QUOTED
| keyword { $$= $1; } | keyword_ident { $$= $1; }
; ;
IDENT_sys: IDENT_sys:
...@@ -15189,16 +15194,32 @@ TEXT_STRING_filesystem: ...@@ -15189,16 +15194,32 @@ TEXT_STRING_filesystem:
ident_table_alias: ident_table_alias:
IDENT_sys IDENT_sys
| keyword_alias | keyword_table_alias
{ {
if (unlikely($$.copy_keyword(thd, &$1))) if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
; ;
ident_sysvar_name:
IDENT_sys
| keyword_sysvar_name
{
if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
}
| TEXT_STRING_sys
{
if (unlikely($$.copy_sys(thd, &$1)))
MYSQL_YYABORT;
}
;
ident: ident:
IDENT_sys IDENT_sys
| keyword | keyword_ident
{ {
if (unlikely($$.copy_keyword(thd, &$1))) if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -15207,7 +15228,7 @@ ident: ...@@ -15207,7 +15228,7 @@ ident:
label_ident: label_ident:
IDENT_sys IDENT_sys
| keyword_sp | keyword_label
{ {
if (unlikely($$.copy_keyword(thd, &$1))) if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -15285,15 +15306,74 @@ user: user_maybe_role ...@@ -15285,15 +15306,74 @@ user: user_maybe_role
; ;
/* Keywords which we allow as table aliases. */ /* Keywords which we allow as table aliases. */
keyword_alias: keyword_table_alias:
keyword_sp keyword_data_type
| keyword_sp_verb_clause | keyword_sp_block_section
| ASCII_SYM | keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
| WINDOW_SYM
;
/*
Keywords that we allow for labels in SPs.
Should not include keywords that start a statement or SP characteristics.
*/
keyword_label:
keyword_data_type
| keyword_sp_var_and_label
| keyword_sysvar_type
;
keyword_sysvar_name:
keyword_data_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_verb_clause
| WINDOW_SYM
;
keyword_sp_decl:
keyword_data_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
| WINDOW_SYM
;
/*
Keywords that we allow in Oracle-style direct assignments:
xxx := 10;
but do not allow in labels in the default sql_mode:
label:
stmt1;
stmt2;
TODO: check if some of them can migrate to keyword_sp_var_and_label.
*/
keyword_sp_var_not_label:
ASCII_SYM
| BACKUP_SYM | BACKUP_SYM
| BINLOG_SYM | BINLOG_SYM
| BYTE_SYM | BYTE_SYM
| CACHE_SYM | CACHE_SYM
| CHARSET
| CHECKSUM_SYM | CHECKSUM_SYM
| CHECKPOINT_SYM | CHECKPOINT_SYM
| COLUMN_ADD_SYM | COLUMN_ADD_SYM
...@@ -15302,21 +15382,17 @@ keyword_alias: ...@@ -15302,21 +15382,17 @@ keyword_alias:
| COLUMN_DELETE_SYM | COLUMN_DELETE_SYM
| COLUMN_GET_SYM | COLUMN_GET_SYM
| COMMENT_SYM | COMMENT_SYM
| CONTAINS_SYM
| DEALLOCATE_SYM | DEALLOCATE_SYM
| EXAMINED_SYM | EXAMINED_SYM
| EXCLUDE_SYM | EXCLUDE_SYM
| EXECUTE_SYM | EXECUTE_SYM
| FLUSH_SYM | FLUSH_SYM
| FOLLOWS_SYM
| FOLLOWING_SYM | FOLLOWING_SYM
| FORMAT_SYM | FORMAT_SYM
| GET_SYM | GET_SYM
| HELP_SYM | HELP_SYM
| HOST_SYM | HOST_SYM
| INSTALL_SYM | INSTALL_SYM
| LANGUAGE_SYM
| NO_SYM
| OPTION | OPTION
| OPTIONS_SYM | OPTIONS_SYM
| OTHERS_SYM | OTHERS_SYM
...@@ -15324,7 +15400,6 @@ keyword_alias: ...@@ -15324,7 +15400,6 @@ keyword_alias:
| PARSER_SYM | PARSER_SYM
| PERIOD_SYM | PERIOD_SYM
| PORT_SYM | PORT_SYM
| PRECEDES_SYM
| PRECEDING_SYM | PRECEDING_SYM
| PREPARE_SYM | PREPARE_SYM
| REMOVE_SYM | REMOVE_SYM
...@@ -15350,22 +15425,52 @@ keyword_alias: ...@@ -15350,22 +15425,52 @@ keyword_alias:
| UPGRADE_SYM | UPGRADE_SYM
; ;
/* Keyword that we allow for identifiers (except SP labels) */
keyword: keyword_alias | WINDOW_SYM;
/* /*
* Keywords that we allow for labels in SPs. Keywords that can start optional clauses in SP or trigger declarations
* Anything that's the beginning of a statement or characteristics Allowed as identifiers (e.g. table, column names),
* must be in keyword above, otherwise we get (harmful) shift/reduce but:
* conflicts. - not allowed as SP label names
*/ - not allowed as variable names in Oracle-style assignments:
keyword_sp: xxx := 10;
keyword_sp_data_type
| keyword_sp_not_data_type If we allowed these variables in assignments, there would be conflicts
with SP characteristics, or verb clauses, or compound statements, e.g.:
CREATE PROCEDURE p1 LANGUAGE ...
would be either:
CREATE PROCEDURE p1 LANGUAGE SQL BEGIN END;
or
CREATE PROCEDURE p1 LANGUAGE:=10;
Note, these variables can still be assigned using quoted identifiers:
`do`:= 10;
"do":= 10; (when ANSI_QUOTES)
or using a SET statement:
SET do= 10;
Note, some of these keywords are reserved keywords in Oracle.
In case if heavy grammar conflicts are found in the future,
we'll possibly need to make them reserved for sql_mode=ORACLE.
TODO: Allow these variables as SP lables when sql_mode=ORACLE.
TODO: Allow assigning of "SP characteristics" marked variables
inside compound blocks.
TODO: Allow "follows" and "precedes" as variables in compound blocks:
BEGIN
follows := 10;
END;
as they conflict only with non-block FOR EACH ROW statement:
CREATE TRIGGER .. FOR EACH ROW follows:= 10;
CREATE TRIGGER .. FOR EACH ROW FOLLOWS tr1 a:= 10;
*/
keyword_sp_head:
CONTAINS_SYM /* SP characteristic */
| LANGUAGE_SYM /* SP characteristic */
| NO_SYM /* SP characteristic */
| CHARSET /* SET CHARSET utf8; */
| FOLLOWS_SYM /* Conflicts with assignment in FOR EACH */
| PRECEDES_SYM /* Conflicts with assignment in FOR EACH */
; ;
/* /*
Keywords that start a statement. Keywords that start a statement.
Generally allowed as identifiers (e.g. table, column names) Generally allowed as identifiers (e.g. table, column names)
...@@ -15373,12 +15478,10 @@ keyword_sp: ...@@ -15373,12 +15478,10 @@ keyword_sp:
- not allowed as variable names in Oracle-style assignments: - not allowed as variable names in Oracle-style assignments:
xxx:=10 xxx:=10
*/ */
keyword_sp_verb_clause: keyword_verb_clause:
BEGIN_SYM /* Compound. Reserved in Oracle */ CLOSE_SYM /* Verb clause. Reserved in Oracle */
| CLOSE_SYM /* Verb clause. Reserved in Oracle */
| COMMIT_SYM /* Verb clause. Reserved in Oracle */ | COMMIT_SYM /* Verb clause. Reserved in Oracle */
| DO_SYM /* Verb clause */ | DO_SYM /* Verb clause */
| END /* Compound. Reserved in Oracle */
| HANDLER_SYM /* Verb clause */ | HANDLER_SYM /* Verb clause */
| OPEN_SYM /* Verb clause. Reserved in Oracle */ | OPEN_SYM /* Verb clause. Reserved in Oracle */
| REPAIR /* Verb clause */ | REPAIR /* Verb clause */
...@@ -15388,12 +15491,26 @@ keyword_sp_verb_clause: ...@@ -15388,12 +15491,26 @@ keyword_sp_verb_clause:
| TRUNCATE_SYM /* Verb clause. Reserved in Oracle */ | TRUNCATE_SYM /* Verb clause. Reserved in Oracle */
; ;
/*
Keywords that start an SP block section.
*/
keyword_sp_block_section:
BEGIN_SYM
| END
;
keyword_sysvar_type:
GLOBAL_SYM
| LOCAL_SYM
| SESSION_SYM
;
/* /*
These keywords are generally allowed as identifiers, These keywords are generally allowed as identifiers,
but not allowed as non-delimited SP variable names in sql_mode=ORACLE. but not allowed as non-delimited SP variable names in sql_mode=ORACLE.
*/ */
keyword_sp_data_type: keyword_data_type:
BIT_SYM BIT_SYM
| BOOLEAN_SYM | BOOLEAN_SYM
| BOOL_SYM | BOOL_SYM
...@@ -15427,7 +15544,10 @@ keyword_sp_data_type: ...@@ -15427,7 +15544,10 @@ keyword_sp_data_type:
; ;
keyword_sp_not_data_type: /*
These keywords are fine for both SP variable names and SP labels.
*/
keyword_sp_var_and_label:
ACTION ACTION
| ADDDATE_SYM | ADDDATE_SYM
| ADMIN_SYM | ADMIN_SYM
...@@ -15525,7 +15645,6 @@ keyword_sp_not_data_type: ...@@ -15525,7 +15645,6 @@ keyword_sp_not_data_type:
| GENERATED_SYM | GENERATED_SYM
| GET_FORMAT | GET_FORMAT
| GRANTS | GRANTS
| GLOBAL_SYM
| GOTO_SYM | GOTO_SYM
| HASH_SYM | HASH_SYM
| HARD_SYM | HARD_SYM
...@@ -15556,7 +15675,6 @@ keyword_sp_not_data_type: ...@@ -15556,7 +15675,6 @@ keyword_sp_not_data_type:
| LESS_SYM | LESS_SYM
| LEVEL_SYM | LEVEL_SYM
| LIST_SYM | LIST_SYM
| LOCAL_SYM
| LOCKS_SYM | LOCKS_SYM
| LOGFILE_SYM | LOGFILE_SYM
| LOGS_SYM | LOGS_SYM
...@@ -15681,7 +15799,6 @@ keyword_sp_not_data_type: ...@@ -15681,7 +15799,6 @@ keyword_sp_not_data_type:
| SECOND_SYM | SECOND_SYM
| SEQUENCE_SYM | SEQUENCE_SYM
| SERIALIZABLE_SYM | SERIALIZABLE_SYM
| SESSION_SYM
| SETVAL_SYM | SETVAL_SYM
| SIMPLE_SYM | SIMPLE_SYM
| SHARE_SYM | SHARE_SYM
...@@ -15933,12 +16050,12 @@ option_value_no_option_type: ...@@ -15933,12 +16050,12 @@ option_value_no_option_type:
if (unlikely(Lex->set_user_variable(thd, &$2, $4))) if (unlikely(Lex->set_user_variable(thd, &$2, $4)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| '@' '@' opt_var_ident_type ident equal set_expr_or_default | '@' '@' opt_var_ident_type ident_sysvar_name equal set_expr_or_default
{ {
if (unlikely(Lex->set_system_variable($3, &$4, $6))) if (unlikely(Lex->set_system_variable($3, &$4, $6)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| '@' '@' opt_var_ident_type ident '.' ident equal set_expr_or_default | '@' '@' opt_var_ident_type ident_sysvar_name '.' ident equal set_expr_or_default
{ {
if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $8))) if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $8)))
MYSQL_YYABORT; MYSQL_YYABORT;
......
...@@ -282,10 +282,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -282,10 +282,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd } %parse-param { THD *thd }
%lex-param { THD *thd } %lex-param { THD *thd }
/* /*
Currently there are 69 shift/reduce conflicts. Currently there are 63 shift/reduce conflicts.
We should not introduce new conflicts any more. We should not introduce new conflicts any more.
*/ */
%expect 69 %expect 63
/* /*
Comments for TOKENS. Comments for TOKENS.
...@@ -638,7 +638,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -638,7 +638,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> AVG_ROW_LENGTH %token <kwd> AVG_ROW_LENGTH
%token <kwd> AVG_SYM /* SQL-2003-N */ %token <kwd> AVG_SYM /* SQL-2003-N */
%token <kwd> BACKUP_SYM %token <kwd> BACKUP_SYM
%token <kwd> BEGIN_SYM /* SQL-2003-R */ %token <kwd> BEGIN_SYM /* SQL-2003-R, PLSQL-R */
%token <kwd> BINLOG_SYM %token <kwd> BINLOG_SYM
%token <kwd> BIT_SYM /* MYSQL-FUNC */ %token <kwd> BIT_SYM /* MYSQL-FUNC */
%token <kwd> BLOCK_SYM %token <kwd> BLOCK_SYM
...@@ -712,7 +712,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -712,7 +712,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> DUPLICATE_SYM %token <kwd> DUPLICATE_SYM
%token <kwd> DYNAMIC_SYM /* SQL-2003-R */ %token <kwd> DYNAMIC_SYM /* SQL-2003-R */
%token <kwd> ENABLE_SYM %token <kwd> ENABLE_SYM
%token <kwd> END /* SQL-2003-R */ %token <kwd> END /* SQL-2003-R, PLSQL-R */
%token <kwd> ENDS_SYM %token <kwd> ENDS_SYM
%token <kwd> ENGINES_SYM %token <kwd> ENGINES_SYM
%token <kwd> ENGINE_SYM %token <kwd> ENGINE_SYM
...@@ -745,7 +745,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -745,7 +745,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> FORMAT_SYM %token <kwd> FORMAT_SYM
%token <kwd> FOUND_SYM /* SQL-2003-R */ %token <kwd> FOUND_SYM /* SQL-2003-R */
%token <kwd> FULL /* SQL-2003-R */ %token <kwd> FULL /* SQL-2003-R */
%token <kwd> FUNCTION_SYM /* SQL-2003-R */ %token <kwd> FUNCTION_SYM /* SQL-2003-R, Oracle-PLSQL-R */
%token <kwd> GENERAL %token <kwd> GENERAL
%token <kwd> GENERATED_SYM %token <kwd> GENERATED_SYM
%token <kwd> GEOMETRYCOLLECTION %token <kwd> GEOMETRYCOLLECTION
...@@ -1156,7 +1156,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1156,7 +1156,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
HEX_NUM HEX_STRING HEX_NUM HEX_STRING
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident_or_text LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident_or_text
TEXT_STRING_sys TEXT_STRING_literal TEXT_STRING_sys TEXT_STRING_literal
opt_component key_cache_name key_cache_name
sp_opt_label BIN_NUM TEXT_STRING_filesystem sp_opt_label BIN_NUM TEXT_STRING_filesystem
opt_constraint constraint opt_ident opt_constraint constraint opt_ident
opt_package_routine_end_name opt_package_routine_end_name
...@@ -1173,6 +1173,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1173,6 +1173,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
sp_decl_ident sp_decl_ident
ident_or_empty ident_or_empty
ident_table_alias ident_table_alias
ident_sysvar_name
ident_directly_assignable ident_directly_assignable
%type <lex_string_with_metadata> %type <lex_string_with_metadata>
...@@ -1189,14 +1190,19 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1189,14 +1190,19 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ident_cli ident_cli
%type <kwd> %type <kwd>
keyword keyword_sp keyword_data_type
keyword_alias keyword_ident
keyword_label
keyword_sp_block_section
keyword_sp_decl
keyword_sp_head
keyword_sp_var_and_label
keyword_sp_var_not_label
keyword_sysvar_name
keyword_sysvar_type
keyword_table_alias
keyword_verb_clause
keyword_directly_assignable keyword_directly_assignable
keyword_directly_not_assignable
keyword_sp_data_type
keyword_sp_not_data_type
keyword_sp_verb_clause
sp_decl_ident_keyword
%type <table> %type <table>
table_ident table_ident_nodb references xid table_ident table_ident_nodb references xid
...@@ -3782,19 +3788,13 @@ condition_information_item_name: ...@@ -3782,19 +3788,13 @@ condition_information_item_name:
sp_decl_ident: sp_decl_ident:
IDENT_sys IDENT_sys
| sp_decl_ident_keyword | keyword_sp_decl
{ {
if (unlikely($$.copy_ident_cli(thd, &$1))) if (unlikely($$.copy_ident_cli(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
; ;
sp_decl_ident_keyword:
keyword_directly_assignable
| keyword_sp_not_data_type
;
sp_decl_idents: sp_decl_idents:
sp_decl_ident sp_decl_ident
{ {
...@@ -7701,11 +7701,6 @@ opt_ident: ...@@ -7701,11 +7701,6 @@ opt_ident:
| field_ident { $$= $1; } | field_ident { $$= $1; }
; ;
opt_component:
/* empty */ { $$= null_clex_str; }
| '.' ident { $$= $2; }
;
string_list: string_list:
text_string text_string
{ Lex->last_field->interval_list.push_back($1, thd->mem_root); } { Lex->last_field->interval_list.push_back($1, thd->mem_root); }
...@@ -11477,18 +11472,15 @@ variable_aux: ...@@ -11477,18 +11472,15 @@ variable_aux:
LEX *lex= Lex; LEX *lex= Lex;
lex->uncacheable(UNCACHEABLE_SIDEEFFECT); lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
} }
| '@' opt_var_ident_type ident_or_text opt_component | '@' opt_var_ident_type ident_sysvar_name
{
/* disallow "SELECT @@global.global.variable" */
if (unlikely($3.str && $4.str && check_reserved_words(&$3)))
{ {
thd->parse_error(); if (unlikely(!($$= Lex->make_item_sysvar(thd, $2, &$3))))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (unlikely(!($$= get_system_var(thd, $2, &$3, &$4)))) | '@' opt_var_ident_type ident_sysvar_name '.' ident
{
if (unlikely(!($$= Lex->make_item_sysvar(thd, $2, &$3, &$5))))
MYSQL_YYABORT; MYSQL_YYABORT;
if (!((Item_func_get_system_var*) $$)->is_written_to_binlog())
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_VARIABLE);
} }
; ;
...@@ -15342,7 +15334,7 @@ IDENT_cli: ...@@ -15342,7 +15334,7 @@ IDENT_cli:
ident_cli: ident_cli:
IDENT IDENT
| IDENT_QUOTED | IDENT_QUOTED
| keyword { $$= $1; } | keyword_ident { $$= $1; }
; ;
IDENT_sys: IDENT_sys:
...@@ -15379,30 +15371,41 @@ TEXT_STRING_filesystem: ...@@ -15379,30 +15371,41 @@ TEXT_STRING_filesystem:
ident_table_alias: ident_table_alias:
IDENT_sys IDENT_sys
| keyword_alias | keyword_table_alias
{ {
if (unlikely($$.copy_keyword(thd, &$1))) if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
; ;
ident:
ident_sysvar_name:
IDENT_sys IDENT_sys
| keyword | keyword_sysvar_name
{ {
if (unlikely($$.copy_keyword(thd, &$1))) if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| TEXT_STRING_sys
{
if (unlikely($$.copy_sys(thd, &$1)))
MYSQL_YYABORT;
}
; ;
ident_directly_assignable:
ident:
IDENT_sys IDENT_sys
| keyword_directly_assignable | keyword_ident
{ {
if (unlikely($$.copy_keyword(thd, &$1))) if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| keyword_sp ;
ident_directly_assignable:
IDENT_sys
| keyword_directly_assignable
{ {
if (unlikely($$.copy_keyword(thd, &$1))) if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -15412,9 +15415,9 @@ ident_directly_assignable: ...@@ -15412,9 +15415,9 @@ ident_directly_assignable:
label_ident: label_ident:
IDENT_sys IDENT_sys
| keyword_sp | keyword_label
{ {
if ($$.copy_keyword(thd, &$1)) if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -15504,21 +15507,80 @@ user: user_maybe_role ...@@ -15504,21 +15507,80 @@ user: user_maybe_role
; ;
/* Keywords which we allow as table aliases. */ /* Keywords which we allow as table aliases. */
keyword_alias: keyword_table_alias:
keyword_sp keyword_data_type
| keyword_directly_assignable | keyword_sp_block_section
| keyword_directly_not_assignable | keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
| FUNCTION_SYM
; ;
/* Keyword that we allow for identifiers (except SP labels) */ /* Keyword that we allow for identifiers (except SP labels) */
keyword: keyword_alias | WINDOW_SYM; keyword_ident:
keyword_data_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
| FUNCTION_SYM
| WINDOW_SYM
;
/*
Keywords that we allow for labels in SPs.
Should not include keywords that start a statement or SP characteristics.
*/
keyword_label:
keyword_data_type
| keyword_sp_var_and_label
| keyword_sysvar_type
| FUNCTION_SYM
;
keyword_sysvar_name:
keyword_data_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_verb_clause
| FUNCTION_SYM
| WINDOW_SYM
;
keyword_sp_decl:
keyword_sp_head
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
| WINDOW_SYM
;
keyword_directly_assignable:
keyword_data_type
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| FUNCTION_SYM
| WINDOW_SYM
;
/* /*
Keywords that we allow in Oracle-style direct assignments: Keywords that we allow in Oracle-style direct assignments:
xxx := 10; xxx := 10;
but do not allow in labels in the default sql_mode:
label:
stmt1;
stmt2;
TODO: check if some of them can migrate to keyword_sp_var_and_label.
*/ */
keyword_directly_assignable: keyword_sp_var_not_label:
ASCII_SYM ASCII_SYM
| BACKUP_SYM | BACKUP_SYM
| BINLOG_SYM | BINLOG_SYM
...@@ -15579,7 +15641,8 @@ keyword_directly_assignable: ...@@ -15579,7 +15641,8 @@ keyword_directly_assignable:
; ;
/* /*
Keywords that are allowed as identifiers (e.g. table, column names), Keywords that can start optional clauses in SP or trigger declarations
Allowed as identifiers (e.g. table, column names),
but: but:
- not allowed as SP label names - not allowed as SP label names
- not allowed as variable names in Oracle-style assignments: - not allowed as variable names in Oracle-style assignments:
...@@ -15614,43 +15677,26 @@ keyword_directly_assignable: ...@@ -15614,43 +15677,26 @@ keyword_directly_assignable:
CREATE TRIGGER .. FOR EACH ROW follows:= 10; CREATE TRIGGER .. FOR EACH ROW follows:= 10;
CREATE TRIGGER .. FOR EACH ROW FOLLOWS tr1 a:= 10; CREATE TRIGGER .. FOR EACH ROW FOLLOWS tr1 a:= 10;
*/ */
keyword_directly_not_assignable: keyword_sp_head:
CONTAINS_SYM /* SP characteristic */ CONTAINS_SYM /* SP characteristic */
| LANGUAGE_SYM /* SP characteristic */ | LANGUAGE_SYM /* SP characteristic */
| NO_SYM /* SP characteristic */ | NO_SYM /* SP characteristic */
| CHARSET /* SET CHARSET utf8; */ | CHARSET /* SET CHARSET utf8; */
| FOLLOWS_SYM /* Conflicts with assignment in FOR EACH */ | FOLLOWS_SYM /* Conflicts with assignment in FOR EACH */
| PRECEDES_SYM /* Conflicts with assignment in FOR EACH */ | PRECEDES_SYM /* Conflicts with assignment in FOR EACH */
| keyword_sp_verb_clause
;
/*
* Keywords that we allow for labels in SPs.
* Anything that's the beginning of a statement or characteristics
* must be in keyword above, otherwise we get (harmful) shift/reduce
* conflicts.
*/
keyword_sp:
keyword_sp_data_type
| keyword_sp_not_data_type
| FUNCTION_SYM /* Oracle-PLSQL-R */
; ;
/* /*
Keywords that start a statement or an SP block section. Keywords that start a statement.
Generally allowed as identifiers (e.g. table, column names) Generally allowed as identifiers (e.g. table, column names)
- not allowed as SP label names - not allowed as SP label names
- not allowed as variable names in Oracle-style assignments: - not allowed as variable names in Oracle-style assignments:
xxx:=10 xxx:=10
*/ */
keyword_sp_verb_clause: keyword_verb_clause:
BEGIN_SYM /* Compound. Reserved in Oracle */ CLOSE_SYM /* Verb clause. Reserved in Oracle */
| CLOSE_SYM /* Verb clause. Reserved in Oracle */
| COMMIT_SYM /* Verb clause. Reserved in Oracle */ | COMMIT_SYM /* Verb clause. Reserved in Oracle */
| EXCEPTION_SYM /* EXCEPTION section in SP blocks */
| DO_SYM /* Verb clause */ | DO_SYM /* Verb clause */
| END /* Compound. Reserved in Oracle */
| HANDLER_SYM /* Verb clause */ | HANDLER_SYM /* Verb clause */
| OPEN_SYM /* Verb clause. Reserved in Oracle */ | OPEN_SYM /* Verb clause. Reserved in Oracle */
| REPAIR /* Verb clause */ | REPAIR /* Verb clause */
...@@ -15660,12 +15706,27 @@ keyword_sp_verb_clause: ...@@ -15660,12 +15706,27 @@ keyword_sp_verb_clause:
| TRUNCATE_SYM /* Verb clause. Reserved in Oracle */ | TRUNCATE_SYM /* Verb clause. Reserved in Oracle */
; ;
/*
Keywords that start an SP block section.
*/
keyword_sp_block_section:
BEGIN_SYM
| EXCEPTION_SYM
| END
;
keyword_sysvar_type:
GLOBAL_SYM
| LOCAL_SYM
| SESSION_SYM
;
/* /*
These keywords are generally allowed as identifiers, These keywords are generally allowed as identifiers,
but not allowed as non-delimited SP variable names in sql_mode=ORACLE. but not allowed as non-delimited SP variable names in sql_mode=ORACLE.
*/ */
keyword_sp_data_type: keyword_data_type:
BIT_SYM BIT_SYM
| BOOLEAN_SYM | BOOLEAN_SYM
| BOOL_SYM | BOOL_SYM
...@@ -15699,7 +15760,10 @@ keyword_sp_data_type: ...@@ -15699,7 +15760,10 @@ keyword_sp_data_type:
; ;
keyword_sp_not_data_type: /*
These keywords are fine for both SP variable names and SP labels.
*/
keyword_sp_var_and_label:
ACTION ACTION
| ADDDATE_SYM | ADDDATE_SYM
| ADMIN_SYM | ADMIN_SYM
...@@ -15795,7 +15859,6 @@ keyword_sp_not_data_type: ...@@ -15795,7 +15859,6 @@ keyword_sp_not_data_type:
| GENERATED_SYM | GENERATED_SYM
| GET_FORMAT | GET_FORMAT
| GRANTS | GRANTS
| GLOBAL_SYM
| HASH_SYM | HASH_SYM
| HARD_SYM | HARD_SYM
| HOSTS_SYM | HOSTS_SYM
...@@ -15824,7 +15887,6 @@ keyword_sp_not_data_type: ...@@ -15824,7 +15887,6 @@ keyword_sp_not_data_type:
| LESS_SYM | LESS_SYM
| LEVEL_SYM | LEVEL_SYM
| LIST_SYM | LIST_SYM
| LOCAL_SYM
| LOCKS_SYM | LOCKS_SYM
| LOGFILE_SYM | LOGFILE_SYM
| LOGS_SYM | LOGS_SYM
...@@ -15948,7 +16010,6 @@ keyword_sp_not_data_type: ...@@ -15948,7 +16010,6 @@ keyword_sp_not_data_type:
| SECOND_SYM | SECOND_SYM
| SEQUENCE_SYM | SEQUENCE_SYM
| SERIALIZABLE_SYM | SERIALIZABLE_SYM
| SESSION_SYM
| SETVAL_SYM | SETVAL_SYM
| SIMPLE_SYM | SIMPLE_SYM
| SHARE_SYM | SHARE_SYM
...@@ -16245,12 +16306,12 @@ option_value_no_option_type: ...@@ -16245,12 +16306,12 @@ option_value_no_option_type:
if (unlikely(Lex->set_user_variable(thd, &$2, $4))) if (unlikely(Lex->set_user_variable(thd, &$2, $4)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| '@' '@' opt_var_ident_type ident equal set_expr_or_default | '@' '@' opt_var_ident_type ident_sysvar_name equal set_expr_or_default
{ {
if (unlikely(Lex->set_system_variable($3, &$4, $6))) if (unlikely(Lex->set_system_variable($3, &$4, $6)))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| '@' '@' opt_var_ident_type ident '.' ident equal set_expr_or_default | '@' '@' opt_var_ident_type ident_sysvar_name '.' ident equal set_expr_or_default
{ {
if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $8))) if (unlikely(Lex->set_system_variable(thd, $3, &$4, &$6, $8)))
MYSQL_YYABORT; MYSQL_YYABORT;
......
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