Bug #55843 Handled condition appears as not handled
Submitted: 9 Aug 2010 15:09 Modified: 24 Sep 2011 16:42
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version:M3 (Celosia), M4 (Dahlia) OS:Any
Assigned to: Alexander Nozdrin CPU Architecture:Any
Tags: regression

[9 Aug 2010 15:09] Alexander Nozdrin
Description:
A handled condition (error or warning) is shown as not handled
at the end of statement.

This bug has been introduced by a patch for Bug#23032.

How to repeat:
> delimiter |

> create procedure p1()
begin
  declare continue handler for sqlexception select 1;

  drop table non_existing_table;
end|

> create procedure p2()
begin
  declare continue handler for sqlwarning select 2;

  call p1();
end|

> delimiter ;

> call p2();
1
1
Warnings:
Error	1051	Unknown table 'non_existing_table'

> show warnings;
Level	Code	Message
Error	1051	Unknown table 'non_existing_table'

Instead, it should be:

> call p2();
1
1

> show warnings;
Level	Code	Message
Error	1051	Unknown table 'non_existing_table'
[7 Oct 2010 8:22] 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/commits/120196

3096 Alexander Nozdrin	2010-10-07
      A patch for Bug#55843 (Handled condition appears as not handled).
      
      Patch for Bug 23032 changed the behavior so that handled condition
      (sql warning or exception) left in Warning_info. The problem was
      that handled conditions were treated as unhandled ones, so they
      were shown as "active statement" warnings.
      
      This patch fixes this: handled condition is still kept in Warning_info,
      but it is marked as handled, so it does not appear in a list of
      "active statement" warnings.
[14 Oct 2010 12:30] 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/commits/120770

3239 Alexander Nozdrin	2010-10-14
      A patch for Bug#55843 (Handled condition appears as not handled).
      
      Patch for Bug 23032 changed the behavior so that handled condition
      (sql warning or exception) left in Warning_info. The problem was
      that handled conditions were treated as unhandled ones, so they
      were shown as "active statement" warnings.
      
      This patch consists of two parts:
        1. Refactoring SQL handlers: it changes the way how SQL handlers
           are found and activated
        2. Fix the problem.
      
      1. We used to search handlers recursively (from the current scope up
      to the top one). That was needed because a search for handlers was
      done right when an SQL condition occurs. After patch for Bug 23032
      the search for SQL handlers happens after SQL statement completes.
      That means, there is no need to do a recursive search now:
        - if there are warnings, they are handled by SQL handlers within
          the current scope only;
        - if there is an error, it is propagated to the outer scope.
      
      2. The bug fix is to remove conditions, which have SQL handlers
      from Warning Info.
[25 Nov 2010 22:11] Davi Arnaut
Resetting to Verified, postponed until Bug#55847 is fixed.
[15 Dec 2010 18:24] 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/commits/126993

3426 Alexander Nozdrin	2010-12-15
      A patch for Bug#55843 (Handled condition appears as not handled).
      
      Patch for Bug 23032 changed the behavior so that handled condition
      (sql warning or exception) left in Warning_info. The problem was
      that handled conditions were treated as unhandled ones, so they
      were shown as "active statement" warnings.
      
      This patch consists of two parts:
        1. Refactoring SQL handlers: it changes the way how SQL handlers
           are found and activated
        2. Fix the problem.
      
      1. We used to search handlers recursively (from the current scope up
      to the top one). That was needed because a search for handlers was
      done right when an SQL condition occurs. After patch for Bug 23032
      the search for SQL handlers happens after SQL statement completes.
      That means, there is no need to do a recursive search now:
        - if there are warnings, they are handled by SQL handlers within
          the current scope only;
        - if there is an error, it is propagated to the outer scope.
      
      2. The bug fix is to remove conditions, which have SQL handlers
      from Warning Info.
[26 Dec 2010 8:36] Valeriy Kravchuk
Bug #59169 was marked as a duplicate of this one.
[24 Sep 2011 16:42] Paul DuBois
Noted in 5.6.3 changelog.

A handled condition (error or warning) could be shown as not handled
at the end of the statement.
[3 Jan 2012 10:06] Jon Olav Hauglid
Bug#63864 was marked as a duplicate of this bug.