Commit c29c39a7 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the...

MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
parent e1dc05a6
......@@ -1700,4 +1700,69 @@ SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
(SELECT
1
#
# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
#
CREATE TABLE names (names INT);
SELECT names FROM names AS names;
names
DROP TABLE names;
CREATE TABLE password (password INT);
SELECT password FROM password AS password;
password
DROP TABLE password;
CREATE TABLE role (role INT);
SELECT role FROM role AS role;
role
DROP TABLE role;
BEGIN NOT ATOMIC
DECLARE names VARCHAR(32) DEFAULT '[names]';
DECLARE password VARCHAR(32) DEFAULT '[password]';
DECLARE role VARCHAR(32) DEFAULT '[role]';
names:
LOOP
SELECT names;
LEAVE names;
END LOOP;
password:
LOOP
SELECT password;
LEAVE password;
END LOOP;
role:
LOOP
SELECT role;
LEAVE role;
END LOOP;
END;
$$
names
[names]
password
[password]
role
[role]
BEGIN NOT ATOMIC
DECLARE names VARCHAR(32);
SET names='[names]';
END;
$$
ERROR 42000: Variable 'names' must be quoted with `...`, or renamed
BEGIN NOT ATOMIC
DECLARE password VARCHAR(32);
SET password='[password]';
END;
$$
ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
BEGIN NOT ATOMIC
DECLARE role VARCHAR(32);
SET role='[role]';
END;
$$
SELECT @@GLOBAL.names;
ERROR HY000: Unknown system variable 'names'
SELECT @@GLOBAL.password;
ERROR HY000: Unknown system variable 'password'
SELECT @@GLOBAL.role;
ERROR HY000: Unknown system variable 'role'
End of 10.3 tests
......@@ -1459,4 +1459,78 @@ DROP PROCEDURE p1;
(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1
)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
--echo #
--echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
--echo #
CREATE TABLE names (names INT);
SELECT names FROM names AS names;
DROP TABLE names;
CREATE TABLE password (password INT);
SELECT password FROM password AS password;
DROP TABLE password;
CREATE TABLE role (role INT);
SELECT role FROM role AS role;
DROP TABLE role;
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE names VARCHAR(32) DEFAULT '[names]';
DECLARE password VARCHAR(32) DEFAULT '[password]';
DECLARE role VARCHAR(32) DEFAULT '[role]';
names:
LOOP
SELECT names;
LEAVE names;
END LOOP;
password:
LOOP
SELECT password;
LEAVE password;
END LOOP;
role:
LOOP
SELECT role;
LEAVE role;
END LOOP;
END;
$$
DELIMITER ;$$
DELIMITER $$;
--error ER_SP_BAD_VAR_SHADOW
BEGIN NOT ATOMIC
DECLARE names VARCHAR(32);
SET names='[names]';
END;
$$
DELIMITER ;$$
DELIMITER $$;
--error ER_SP_BAD_VAR_SHADOW
BEGIN NOT ATOMIC
DECLARE password VARCHAR(32);
SET password='[password]';
END;
$$
DELIMITER ;$$
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE role VARCHAR(32);
SET role='[role]';
END;
$$
DELIMITER ;$$
--error ER_UNKNOWN_SYSTEM_VARIABLE
SELECT @@GLOBAL.names;
--error ER_UNKNOWN_SYSTEM_VARIABLE
SELECT @@GLOBAL.password;
--error ER_UNKNOWN_SYSTEM_VARIABLE
SELECT @@GLOBAL.role;
--echo End of 10.3 tests
......@@ -546,3 +546,66 @@ BEGIN
NULL;
END;
/
#
# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
#
CREATE TABLE names (names INT);
SELECT names FROM names AS names;
names
DROP TABLE names;
CREATE TABLE password (password INT);
SELECT password FROM password AS password;
password
DROP TABLE password;
CREATE TABLE role (role INT);
SELECT role FROM role AS role;
role
DROP TABLE role;
DECLARE
names VARCHAR(32) DEFAULT '[names]';
password VARCHAR(32) DEFAULT '[password]';
role VARCHAR(32) DEFAULT '[role]';
BEGIN
<<names>>
SELECT names;
<<password>>
SELECT password;
<<role>>
SELECT role;
END;
$$
names
[names]
password
[password]
role
[role]
DECLARE
names VARCHAR(32);
BEGIN
SET names='[names]';
END;
$$
ERROR 42000: Variable 'names' must be quoted with `...`, or renamed
DECLARE
password VARCHAR(32);
BEGIN
SET password='[password]';
END;
$$
ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
DECLARE
role VARCHAR(32);
BEGIN
SET role='[role]';
END;
$$
SELECT @@GLOBAL.names;
ERROR HY000: Unknown system variable 'names'
SELECT @@GLOBAL.password;
ERROR HY000: Unknown system variable 'password'
SELECT @@GLOBAL.role;
ERROR HY000: Unknown system variable 'role'
#
# End of 10.3 tests
#
......@@ -339,3 +339,76 @@ END;
/
DELIMITER ;/
--echo #
--echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
--echo #
CREATE TABLE names (names INT);
SELECT names FROM names AS names;
DROP TABLE names;
CREATE TABLE password (password INT);
SELECT password FROM password AS password;
DROP TABLE password;
CREATE TABLE role (role INT);
SELECT role FROM role AS role;
DROP TABLE role;
DELIMITER $$;
DECLARE
names VARCHAR(32) DEFAULT '[names]';
password VARCHAR(32) DEFAULT '[password]';
role VARCHAR(32) DEFAULT '[role]';
BEGIN
<<names>>
SELECT names;
<<password>>
SELECT password;
<<role>>
SELECT role;
END;
$$
DELIMITER ;$$
DELIMITER $$;
--error ER_SP_BAD_VAR_SHADOW
DECLARE
names VARCHAR(32);
BEGIN
SET names='[names]';
END;
$$
DELIMITER ;$$
DELIMITER $$;
--error ER_SP_BAD_VAR_SHADOW
DECLARE
password VARCHAR(32);
BEGIN
SET password='[password]';
END;
$$
DELIMITER ;$$
DELIMITER $$;
DECLARE
role VARCHAR(32);
BEGIN
SET role='[role]';
END;
$$
DELIMITER ;$$
--error ER_UNKNOWN_SYSTEM_VARIABLE
SELECT @@GLOBAL.names;
--error ER_UNKNOWN_SYSTEM_VARIABLE
SELECT @@GLOBAL.password;
--error ER_UNKNOWN_SYSTEM_VARIABLE
SELECT @@GLOBAL.role;
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -884,10 +884,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
Currently there are 56 shift/reduce conflicts.
Currently there are 52 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
%expect 56
%expect 52
/*
Comments for TOKENS.
......@@ -1807,6 +1807,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ident
label_ident
sp_decl_ident
ident_set_usual_case
ident_or_empty
ident_table_alias
ident_sysvar_name
......@@ -1828,6 +1829,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keyword_data_type
keyword_ident
keyword_label
keyword_set_special_case
keyword_set_usual_case
keyword_sp_block_section
keyword_sp_decl
keyword_sp_head
......@@ -15509,6 +15512,14 @@ ident_table_alias:
}
;
ident_set_usual_case:
IDENT_sys
| keyword_set_usual_case
{
if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
}
;
ident_sysvar_name:
IDENT_sys
......@@ -15616,6 +15627,7 @@ user: user_maybe_role
/* Keywords which we allow as table aliases. */
keyword_table_alias:
keyword_data_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
......@@ -15627,6 +15639,7 @@ keyword_table_alias:
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
......@@ -15642,12 +15655,14 @@ keyword_ident:
*/
keyword_label:
keyword_data_type
| keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sysvar_type
;
keyword_sysvar_name:
keyword_data_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
......@@ -15658,6 +15673,18 @@ keyword_sysvar_name:
keyword_sp_decl:
keyword_data_type
| keyword_set_special_case
| 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
;
keyword_set_usual_case:
keyword_data_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
......@@ -15799,6 +15826,12 @@ keyword_verb_clause:
| TRUNCATE_SYM /* Verb clause. Reserved in Oracle */
;
keyword_set_special_case:
NAMES_SYM
| ROLE_SYM
| PASSWORD_SYM
;
/*
Keywords that start an SP block section.
*/
......@@ -16036,7 +16069,6 @@ keyword_sp_var_and_label:
| MYSQL_SYM
| MYSQL_ERRNO_SYM
| NAME_SYM
| NAMES_SYM
| NEXT_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| NEXTVAL_SYM
| NEW_SYM
......@@ -16061,7 +16093,6 @@ keyword_sp_var_and_label:
| PARTIAL
| PARTITIONING_SYM
| PARTITIONS_SYM
| PASSWORD_SYM
| PERSISTENT_SYM
| PHASE_SYM
| PLUGIN_SYM
......@@ -16101,7 +16132,6 @@ keyword_sp_var_and_label:
| RETURNS_SYM
| REUSE_SYM
| REVERSE_SYM
| ROLE_SYM
| ROLLUP_SYM
| ROUTINE_SYM
| ROWCOUNT_SYM
......@@ -16345,7 +16375,7 @@ option_value_following_option_type:
/* Option values without preceding option_type. */
option_value_no_option_type:
ident equal set_expr_or_default
ident_set_usual_case equal set_expr_or_default
{
if (unlikely(Lex->set_variable(&$1, $3)))
MYSQL_YYABORT;
......@@ -16462,6 +16492,11 @@ option_value_no_option_type:
unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
}
| ROLE_SYM equal set_expr_or_default
{
if (unlikely(Lex->set_variable(&$1, $3)))
MYSQL_YYABORT;
}
| PASSWORD_SYM opt_for_user text_or_password
{
LEX *lex = Lex;
......
......@@ -278,10 +278,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
Currently there are 57 shift/reduce conflicts.
Currently there are 53 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
%expect 57
%expect 53
/*
Comments for TOKENS.
......@@ -1203,6 +1203,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
ident
label_ident
sp_decl_ident
ident_set_usual_case
ident_or_empty
ident_table_alias
ident_sysvar_name
......@@ -1225,6 +1226,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keyword_data_type
keyword_ident
keyword_label
keyword_set_special_case
keyword_set_usual_case
keyword_sp_block_section
keyword_sp_decl
keyword_sp_head
......@@ -15477,6 +15480,14 @@ ident_table_alias:
}
;
ident_set_usual_case:
IDENT_sys
| keyword_set_usual_case
{
if (unlikely($$.copy_keyword(thd, &$1)))
MYSQL_YYABORT;
}
;
ident_sysvar_name:
IDENT_sys
......@@ -15608,6 +15619,7 @@ user: user_maybe_role
/* Keywords which we allow as table aliases. */
keyword_table_alias:
keyword_data_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
......@@ -15620,6 +15632,7 @@ keyword_table_alias:
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
......@@ -15636,6 +15649,7 @@ keyword_ident:
*/
keyword_label:
keyword_data_type
| keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sysvar_type
| FUNCTION_SYM
......@@ -15643,6 +15657,7 @@ keyword_label:
keyword_sysvar_name:
keyword_data_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
......@@ -15654,15 +15669,29 @@ keyword_sysvar_name:
keyword_sp_decl:
keyword_sp_head
| keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
| WINDOW_SYM
;
keyword_set_usual_case:
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
;
keyword_directly_assignable:
keyword_data_type
| keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sp_var_not_label
| keyword_sysvar_type
......@@ -15802,6 +15831,12 @@ keyword_verb_clause:
| TRUNCATE_SYM /* Verb clause. Reserved in Oracle */
;
keyword_set_special_case:
NAMES_SYM
| ROLE_SYM
| PASSWORD_SYM
;
/*
Keywords that start an SP block section.
*/
......@@ -16039,7 +16074,6 @@ keyword_sp_var_and_label:
| MYSQL_SYM
| MYSQL_ERRNO_SYM
| NAME_SYM
| NAMES_SYM
| NEXT_SYM %prec PREC_BELOW_CONTRACTION_TOKEN2
| NEXTVAL_SYM
| NEW_SYM
......@@ -16064,7 +16098,6 @@ keyword_sp_var_and_label:
| PARTIAL
| PARTITIONING_SYM
| PARTITIONS_SYM
| PASSWORD_SYM
| PERSISTENT_SYM
| PHASE_SYM
| PLUGIN_SYM
......@@ -16104,7 +16137,6 @@ keyword_sp_var_and_label:
| RETURNS_SYM
| REUSE_SYM
| REVERSE_SYM
| ROLE_SYM
| ROLLUP_SYM
| ROUTINE_SYM
| ROWCOUNT_SYM
......@@ -16397,7 +16429,7 @@ option_value_following_option_type:
/* Option values without preceding option_type. */
option_value_no_option_type:
ident equal set_expr_or_default
ident_set_usual_case equal set_expr_or_default
{
if (unlikely(Lex->set_variable(&$1, $3)))
MYSQL_YYABORT;
......@@ -16514,6 +16546,11 @@ option_value_no_option_type:
unlikely(lex->var_list.push_back(var, thd->mem_root)))
MYSQL_YYABORT;
}
| ROLE_SYM equal set_expr_or_default
{
if (unlikely(Lex->set_variable(&$1, $3)))
MYSQL_YYABORT;
}
| PASSWORD_SYM opt_for_user text_or_password
{
LEX *lex = Lex;
......
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