Commit 7f4aee22 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved

parent f5855ba0
...@@ -532,3 +532,17 @@ BEGIN ...@@ -532,3 +532,17 @@ BEGIN
NULL; NULL;
END; END;
/ /
#
# MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved
#
DECLARE
ELSEIF INT;
BEGIN
ELSEIF:=1;
END;
/
BEGIN
<<ELSEIF>>
NULL;
END;
/
...@@ -316,3 +316,26 @@ BEGIN ...@@ -316,3 +316,26 @@ BEGIN
END; END;
/ /
DELIMITER ;/ DELIMITER ;/
--echo #
--echo # MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved
--echo #
DELIMITER /;
DECLARE
ELSEIF INT;
BEGIN
ELSEIF:=1;
END;
/
DELIMITER ;/
DELIMITER /;
BEGIN
<<ELSEIF>>
NULL;
END;
/
DELIMITER ;/
...@@ -258,7 +258,8 @@ void compute_tokens() ...@@ -258,7 +258,8 @@ void compute_tokens()
set_start_expr_token(RETURN_MARIADB_SYM); set_start_expr_token(RETURN_MARIADB_SYM);
set_start_expr_token(RETURN_ORACLE_SYM); set_start_expr_token(RETURN_ORACLE_SYM);
set_start_expr_token(IF_SYM); set_start_expr_token(IF_SYM);
set_start_expr_token(ELSEIF_SYM); set_start_expr_token(ELSEIF_MARIADB_SYM);
set_start_expr_token(ELSEIF_ORACLE_SYM);
set_start_expr_token(CASE_SYM); set_start_expr_token(CASE_SYM);
set_start_expr_token(WHEN_SYM); set_start_expr_token(WHEN_SYM);
set_start_expr_token(WHILE_SYM); set_start_expr_token(WHILE_SYM);
......
...@@ -205,7 +205,7 @@ static SYMBOL symbols[] = { ...@@ -205,7 +205,7 @@ static SYMBOL symbols[] = {
{ "DYNAMIC", SYM(DYNAMIC_SYM)}, { "DYNAMIC", SYM(DYNAMIC_SYM)},
{ "EACH", SYM(EACH_SYM)}, { "EACH", SYM(EACH_SYM)},
{ "ELSE", SYM(ELSE)}, { "ELSE", SYM(ELSE)},
{ "ELSEIF", SYM(ELSEIF_SYM)}, { "ELSEIF", SYM(ELSEIF_MARIADB_SYM)},
{ "ELSIF", SYM(ELSIF_MARIADB_SYM)}, { "ELSIF", SYM(ELSIF_MARIADB_SYM)},
{ "ENABLE", SYM(ENABLE_SYM)}, { "ENABLE", SYM(ENABLE_SYM)},
{ "ENCLOSED", SYM(ENCLOSED)}, { "ENCLOSED", SYM(ENCLOSED)},
......
...@@ -845,6 +845,7 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd, ...@@ -845,6 +845,7 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
case BODY_MARIADB_SYM: return BODY_ORACLE_SYM; case BODY_MARIADB_SYM: return BODY_ORACLE_SYM;
case CONTINUE_MARIADB_SYM: return CONTINUE_ORACLE_SYM; case CONTINUE_MARIADB_SYM: return CONTINUE_ORACLE_SYM;
case DECODE_MARIADB_SYM: return DECODE_ORACLE_SYM; case DECODE_MARIADB_SYM: return DECODE_ORACLE_SYM;
case ELSEIF_MARIADB_SYM: return ELSEIF_ORACLE_SYM;
case ELSIF_MARIADB_SYM: return ELSIF_ORACLE_SYM; case ELSIF_MARIADB_SYM: return ELSIF_ORACLE_SYM;
case EXCEPTION_MARIADB_SYM: return EXCEPTION_ORACLE_SYM; case EXCEPTION_MARIADB_SYM: return EXCEPTION_ORACLE_SYM;
case EXIT_MARIADB_SYM: return EXIT_ORACLE_SYM; case EXIT_MARIADB_SYM: return EXIT_ORACLE_SYM;
......
...@@ -984,7 +984,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -984,7 +984,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DUAL_SYM %token DUAL_SYM
%token EACH_SYM /* SQL-2003-R */ %token EACH_SYM /* SQL-2003-R */
%token ELSE /* SQL-2003-R */ %token ELSE /* SQL-2003-R */
%token ELSEIF_SYM %token ELSEIF_MARIADB_SYM
%token ELSIF_ORACLE_SYM /* PLSQL-R */ %token ELSIF_ORACLE_SYM /* PLSQL-R */
%token ENCLOSED %token ENCLOSED
%token END_OF_INPUT /* INTERNAL */ %token END_OF_INPUT /* INTERNAL */
...@@ -1219,6 +1219,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1219,6 +1219,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
Keywords that have different reserved status in std/oracle modes. Keywords that have different reserved status in std/oracle modes.
*/ */
%token <kwd> BODY_MARIADB_SYM // Oracle-R %token <kwd> BODY_MARIADB_SYM // Oracle-R
%token <kwd> ELSEIF_ORACLE_SYM
%token <kwd> ELSIF_MARIADB_SYM // PLSQL-R %token <kwd> ELSIF_MARIADB_SYM // PLSQL-R
%token <kwd> EXCEPTION_ORACLE_SYM // SQL-2003-N, PLSQL-R %token <kwd> EXCEPTION_ORACLE_SYM // SQL-2003-N, PLSQL-R
%token <kwd> GOTO_MARIADB_SYM // Oracle-R %token <kwd> GOTO_MARIADB_SYM // Oracle-R
...@@ -4510,7 +4511,7 @@ sp_if: ...@@ -4510,7 +4511,7 @@ sp_if:
sp_elseifs: sp_elseifs:
/* Empty */ /* Empty */
| ELSEIF_SYM sp_if | ELSEIF_MARIADB_SYM sp_if
| ELSE sp_proc_stmts1 | ELSE sp_proc_stmts1
; ;
...@@ -15883,6 +15884,7 @@ keyword_sp_var_and_label: ...@@ -15883,6 +15884,7 @@ keyword_sp_var_and_label:
| DUMPFILE | DUMPFILE
| DUPLICATE_SYM | DUPLICATE_SYM
| DYNAMIC_SYM | DYNAMIC_SYM
| ELSEIF_ORACLE_SYM
| ELSIF_MARIADB_SYM | ELSIF_MARIADB_SYM
| ENDS_SYM | ENDS_SYM
| ENGINE_SYM | ENGINE_SYM
......
...@@ -378,7 +378,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -378,7 +378,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token DUAL_SYM %token DUAL_SYM
%token EACH_SYM /* SQL-2003-R */ %token EACH_SYM /* SQL-2003-R */
%token ELSE /* SQL-2003-R */ %token ELSE /* SQL-2003-R */
%token ELSEIF_SYM %token ELSEIF_MARIADB_SYM
%token ELSIF_ORACLE_SYM /* PLSQL-R */ %token ELSIF_ORACLE_SYM /* PLSQL-R */
%token ENCLOSED %token ENCLOSED
%token END_OF_INPUT /* INTERNAL */ %token END_OF_INPUT /* INTERNAL */
...@@ -613,6 +613,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -613,6 +613,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
Keywords that have different reserved status in std/oracle modes. Keywords that have different reserved status in std/oracle modes.
*/ */
%token <kwd> BODY_MARIADB_SYM // Oracle-R %token <kwd> BODY_MARIADB_SYM // Oracle-R
%token <kwd> ELSEIF_ORACLE_SYM
%token <kwd> ELSIF_MARIADB_SYM // PLSQL-R %token <kwd> ELSIF_MARIADB_SYM // PLSQL-R
%token <kwd> EXCEPTION_ORACLE_SYM // SQL-2003-N, PLSQL-R %token <kwd> EXCEPTION_ORACLE_SYM // SQL-2003-N, PLSQL-R
%token <kwd> GOTO_MARIADB_SYM // Oracle-R %token <kwd> GOTO_MARIADB_SYM // Oracle-R
...@@ -15917,6 +15918,7 @@ keyword_sp_var_and_label: ...@@ -15917,6 +15918,7 @@ keyword_sp_var_and_label:
| DUMPFILE | DUMPFILE
| DUPLICATE_SYM | DUPLICATE_SYM
| DYNAMIC_SYM | DYNAMIC_SYM
| ELSEIF_ORACLE_SYM
| ELSIF_MARIADB_SYM | ELSIF_MARIADB_SYM
| ENDS_SYM | ENDS_SYM
| ENGINE_SYM | ENGINE_SYM
......
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