Commit fad348a9 authored by Alexander Barkov's avatar Alexander Barkov

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

parent 4612cb88
......@@ -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
#
......@@ -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 #
......@@ -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;
......
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