mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed BUG#3287: Stored procedure handler scope outside of begin/end.
Backpatching overwrote already backpatched instructions, which made it skip the hpop instruction; possibly not only a problem for handlers, but this is one known case when it happened. mysql-test/r/sp-error.result: New testcase for BUG#3287 mysql-test/t/sp-error.test: New testcase for BUG#3287 sql/sp_head.cc: Made the debug printout of hpush_jump instructions somewhat clearer. sql/sp_head.h: Don't backpatch the same instruction more than once.
This commit is contained in:
@ -295,7 +295,7 @@ create function bug1654()
|
||||
returns int
|
||||
return (select sum(t.data) from test.t2 t)|
|
||||
ERROR 0A000: Statements like SELECT, INSERT, UPDATE (and others) are not allowed in a FUNCTION
|
||||
drop table if exists table_1|
|
||||
drop table if exists t3|
|
||||
create table t3 (column_1_0 int)|
|
||||
create procedure bug1653()
|
||||
update t3 set column_1 = 0|
|
||||
@ -362,4 +362,28 @@ end case|
|
||||
call bug3287(2)|
|
||||
ERROR 20000: Case not found for CASE statement
|
||||
drop procedure bug3287|
|
||||
drop table if exists t3|
|
||||
create table t3 (s1 int, primary key (s1))|
|
||||
insert into t3 values (5),(6)|
|
||||
create procedure bug3279(out y int)
|
||||
begin
|
||||
declare x int default 0;
|
||||
begin
|
||||
declare exit handler for sqlexception set x = x+1;
|
||||
insert into t3 values (5);
|
||||
end;
|
||||
if x < 2 then
|
||||
set x = x+1;
|
||||
insert into t3 values (6);
|
||||
end if;
|
||||
set y = x;
|
||||
end|
|
||||
set @x = 0|
|
||||
call bug3279(@x)|
|
||||
ERROR 23000: Duplicate entry '6' for key 1
|
||||
select @x|
|
||||
@x
|
||||
0
|
||||
drop procedure bug3279|
|
||||
drop table t3|
|
||||
drop table t1|
|
||||
|
Reference in New Issue
Block a user