mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed BUG#10961: Stored procedures: crash if select * from dual
Have to catch errors from SELECT when opening a cursor. mysql-test/r/sp.result: New test case for BUG#10961. mysql-test/t/sp.test: New test case for BUG#10961. sql/protocol.h: Init data in Protocol_cursor constructor, for error cases. sql/sp_head.cc: Catch "hidden" errors during SELECT when opening a cursor.
This commit is contained in:
@ -3109,4 +3109,33 @@ select bug9559()|
|
||||
bug9559()
|
||||
-3
|
||||
drop function bug9559|
|
||||
drop procedure if exists bug10961|
|
||||
create procedure bug10961()
|
||||
begin
|
||||
declare v char;
|
||||
declare x int;
|
||||
declare c cursor for select * from dual;
|
||||
declare continue handler for sqlexception select x;
|
||||
set x = 1;
|
||||
open c;
|
||||
set x = 2;
|
||||
fetch c into v;
|
||||
set x = 3;
|
||||
close c;
|
||||
end|
|
||||
call bug10961()|
|
||||
x
|
||||
1
|
||||
x
|
||||
2
|
||||
x
|
||||
3
|
||||
call bug10961()|
|
||||
x
|
||||
1
|
||||
x
|
||||
2
|
||||
x
|
||||
3
|
||||
drop procedure bug10961|
|
||||
drop table t1,t2;
|
||||
|
@ -3801,6 +3801,7 @@ call bug5963_2(1)|
|
||||
drop procedure bug5963_2|
|
||||
drop table t3|
|
||||
|
||||
|
||||
#
|
||||
# BUG#9559: Functions: Numeric Operations using -ve value gives incorrect
|
||||
# results.
|
||||
@ -3820,6 +3821,34 @@ select bug9559()|
|
||||
drop function bug9559|
|
||||
|
||||
|
||||
#
|
||||
# BUG#10961: Stored procedures: crash if select * from dual
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug10961|
|
||||
--enable_warnings
|
||||
# "select * from dual" results in an error, so the cursor will not open
|
||||
create procedure bug10961()
|
||||
begin
|
||||
declare v char;
|
||||
declare x int;
|
||||
declare c cursor for select * from dual;
|
||||
declare continue handler for sqlexception select x;
|
||||
|
||||
set x = 1;
|
||||
open c;
|
||||
set x = 2;
|
||||
fetch c into v;
|
||||
set x = 3;
|
||||
close c;
|
||||
end|
|
||||
|
||||
call bug10961()|
|
||||
call bug10961()|
|
||||
|
||||
drop procedure bug10961|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
Reference in New Issue
Block a user