Bug #14643 Stored Procedure: Continuing after failed var. initialization crashes server.
Submitted: 4 Nov 2005 14:13 Modified: 30 Nov 2005 18:04
Reporter: Per-Erik Martin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S2 (Serious)
Version:bk 5.0.16 OS:Any (Any)
Assigned to: Bugs System

[4 Nov 2005 14:13] Per-Erik Martin
Description:
Continuing (with the help of a condition handler) after a variable initialization has failed crashes the server.
This can happen either with an explicit variable (as in 'p' in the example) or with the implicit variable in the simple CASE statement ('q' in the example).

How to repeat:
delimiter //
create procedure p()
begin
  declare continue handler for sqlexception select 'boo';
  begin
    declare v int default x;

    if v then
      select 1;
    end if;
  end;
end//
create procedure q()
begin
  declare continue handler for sqlexception select 'boo';

  case x
  when 1 then
    select 1;
  end case;
end//
delimiter ;

call p();
-- restart server
call q();
[8 Nov 2005 13:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32082
[28 Nov 2005 11:10] Konstantin Osipov
OK to push.
[28 Nov 2005 14:43] Per-Erik Martin
Pushed to 5.0.17 bk.
[30 Nov 2005 18:04] Paul Dubois
Noted in 5.0.17 changelog.