Bug #6029 Stored procedure specific handlers should have priority
Submitted: 11 Oct 2004 13:35 Modified: 23 Oct 2004 14:37
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Per-Erik Martin CPU Architecture:Any

[11 Oct 2004 13:35] Peter Gulutzan
Description:
I can make a stored procedure that has two handlers: one for a specific situation (i.e. a 
specified MySQL error or sqlstate value), one for a general situation (i.e. "sqlexception" or 
"sqlwarning"). If the specific situation arises, then the specific handler should cover it. 
Instead, the last declared handler covers it. 

How to repeat:
mysql> create table t (s1 int, primary key (s1)); 
Query OK, 0 rows affected (0.09 sec) 
 
mysql> insert into t values (1),(1); 
ERROR 1062 (23000): Duplicate entry '1' for key 1 
mysql> delimiter // 
mysql> create procedure p () begin declare exit handler for sqlstate '23000' select 'sqlstate 
''23000'''; declare continue handler for sqlexception select 'sqlexception'; insert into t 
values (1); insert into t values (1); end;// 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> call p()// 
+--------------+ 
| sqlexception | 
+--------------+ 
| sqlexception | 
+--------------+ 
1 row in set (0.00 sec) 
 
+--------------+ 
| sqlexception | 
+--------------+ 
| sqlexception | 
+--------------+ 
1 row in set (0.00 sec) 
 
Query OK, 0 rows affected (0.00 sec)
[11 Oct 2004 14:01] MySQL Verification Team
Verified on latest BK source tree.
[23 Oct 2004 14:37] Per-Erik Martin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html