mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed BUG#9073: Able to declare two handlers for same condition in same scope
mysql-test/r/sp-error.result: Added test case for BUG#9073. mysql-test/t/sp-error.test: Added test case for BUG#9073. sql/share/errmsg.txt: New error message for duplicate condition handlers in stored procedures. sql/sp_pcontext.cc: Keep track on condition handlers in the same block for error checking. sql/sp_pcontext.h: Keep track on condition handlers in the same block for error checking. sql/sql_yacc.yy: Keep track on condition handlers in the same block for error checking.
This commit is contained in:
@ -526,4 +526,45 @@ delete from t1|
|
||||
call bug7299()|
|
||||
ERROR 02000: No data to FETCH
|
||||
drop procedure bug7299|
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare continue handler for sqlexception select 1;
|
||||
declare continue handler for sqlexception select 2;
|
||||
end|
|
||||
ERROR 42000: Duplicate handler declared in the same block
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare condname1 condition for 1234;
|
||||
declare continue handler for condname1 select 1;
|
||||
declare exit handler for condname1 select 2;
|
||||
end|
|
||||
ERROR 42000: Duplicate handler declared in the same block
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare condname1 condition for sqlstate '42000';
|
||||
declare condname2 condition for sqlstate '42000';
|
||||
declare exit handler for condname1 select 1;
|
||||
declare continue handler for condname2 select 2;
|
||||
end|
|
||||
ERROR 42000: Duplicate handler declared in the same block
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare condname1 condition for sqlstate '42000';
|
||||
declare exit handler for condname1 select 1;
|
||||
declare exit handler for sqlstate '42000' select 2;
|
||||
end|
|
||||
ERROR 42000: Duplicate handler declared in the same block
|
||||
drop procedure if exists bug9073|
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare condname1 condition for sqlstate '42000';
|
||||
declare continue handler for condname1 select 1;
|
||||
begin
|
||||
declare exit handler for sqlstate '42000' select 2;
|
||||
begin
|
||||
declare continue handler for sqlstate '42000' select 3;
|
||||
end;
|
||||
end;
|
||||
end|
|
||||
drop procedure bug9073|
|
||||
drop table t1|
|
||||
|
@ -742,6 +742,56 @@ call bug7299()|
|
||||
drop procedure bug7299|
|
||||
|
||||
|
||||
#
|
||||
# BUG#9073: Able to declare two handlers for same condition in same scope
|
||||
#
|
||||
--error ER_SP_DUP_HANDLER
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare continue handler for sqlexception select 1;
|
||||
declare continue handler for sqlexception select 2;
|
||||
end|
|
||||
--error ER_SP_DUP_HANDLER
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare condname1 condition for 1234;
|
||||
declare continue handler for condname1 select 1;
|
||||
declare exit handler for condname1 select 2;
|
||||
end|
|
||||
--error ER_SP_DUP_HANDLER
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare condname1 condition for sqlstate '42000';
|
||||
declare condname2 condition for sqlstate '42000';
|
||||
declare exit handler for condname1 select 1;
|
||||
declare continue handler for condname2 select 2;
|
||||
end|
|
||||
--error ER_SP_DUP_HANDLER
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare condname1 condition for sqlstate '42000';
|
||||
declare exit handler for condname1 select 1;
|
||||
declare exit handler for sqlstate '42000' select 2;
|
||||
end|
|
||||
|
||||
# This should still work.
|
||||
--disable_warnings
|
||||
drop procedure if exists bug9073|
|
||||
--enable_warnings
|
||||
create procedure bug9073()
|
||||
begin
|
||||
declare condname1 condition for sqlstate '42000';
|
||||
declare continue handler for condname1 select 1;
|
||||
begin
|
||||
declare exit handler for sqlstate '42000' select 2;
|
||||
begin
|
||||
declare continue handler for sqlstate '42000' select 3;
|
||||
end;
|
||||
end;
|
||||
end|
|
||||
drop procedure bug9073|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
Reference in New Issue
Block a user