MDEV-22822 sql_mode="oracle" cannot declare without variable errors

This commit is contained in:
Alexander Barkov 2020-06-07 16:23:47 +04:00
parent 4612cb88fa
commit fad348a9a6
3 changed files with 83 additions and 2 deletions

View File

@ -607,5 +607,39 @@ ERROR HY000: Unknown system variable 'password'
SELECT @@GLOBAL.role;
ERROR HY000: Unknown system variable 'role'
#
# MDEV-22822 sql_mode="oracle" cannot declare without variable errors
#
# It's OK to have no declarations between DECLARE and BEGIN.
#
BEGIN
DECLARE
BEGIN
NULL;
END;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
//
DECLARE
BEGIN
NULL;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
//
BEGIN
<<lab>>
DECLARE
BEGIN
NULL;
END;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
//
#
# End of 10.3 tests
#

View File

@ -409,6 +409,53 @@ SELECT @@GLOBAL.password;
SELECT @@GLOBAL.role;
--echo #
--echo # MDEV-22822 sql_mode="oracle" cannot declare without variable errors
--echo #
--echo # It's OK to have no declarations between DECLARE and BEGIN.
--echo #
DELIMITER //;
BEGIN
DECLARE
BEGIN
NULL;
END;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
//
DELIMITER ;//
DELIMITER //;
DECLARE
BEGIN
NULL;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
//
DELIMITER ;//
DELIMITER //;
BEGIN
<<lab>>
DECLARE
BEGIN
NULL;
END;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
//
DELIMITER ;//
--echo #
--echo # End of 10.3 tests
--echo #

View File

@ -4463,7 +4463,7 @@ sp_labeled_block:
{
Lex->sp_block_init(thd, &$1);
}
sp_decl_body_list
opt_sp_decl_body_list
{
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;
@ -4505,7 +4505,7 @@ sp_unlabeled_block:
MYSQL_YYABORT;
Lex->sp_block_init(thd);
}
sp_decl_body_list
opt_sp_decl_body_list
{
if (unlikely(Lex->sp_block_with_exceptions_finalize_declarations(thd)))
MYSQL_YYABORT;