exception handling different in selectable stored procedures
------------------------------------------------------------

                 Key: CORE-3768
                 URL: http://tracker.firebirdsql.org/browse/CORE-3768
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.1.4
         Environment: Noticed in 2.1.4, also present in 2.1.5 snapshot
            Reporter: Philip Williams


The automated rollback-to-savepoint seen in stored procedure calls does not 
occur if the procedure issues a SUSPEND; I don't think that's clearly 
documented in the few places that the automated-rollback is mentioned in 
various literature. I would prefer for it to be fixed, for consistency, but a 
good explanation/documentation could do just as well, I guess.

create exception test_e1 'test';
create table real_a (
 a1 integer
);
commit;

insert into real_a (a1) values (5);
execute block as
begin
 update real_a set a1 = 53;
 exception test_e1;
end
select a1 from real_a; -- will be 5, automated rollback in block

execute block returns (b integer) as
begin
 update real_a set a1 = 53;
 b = 99;
 suspend;
 exception test_e1;
end
select a1 from real_a; -- will be 53, 'suspend' seems to kill rollback

execute block returns (b integer) as
begin
 begin
  update real_a set a1 = 97;
 end
 exception test_e1;
end
select a1 from real_a; -- will not be 97 (the fact that it's in its own 
begin/end doesn't prevent rollback to savepoint, as CORE-1956 or CORE-1953 
implied)

execute block returns (b integer) as
begin
 begin
  update real_a set a1 = 103;
 end
 exception test_e1;
 when any do begin end
end
select a1 from real_a; -- will be 103, because the exception was caught

execute block returns (b integer) as
begin
 begin
  update real_a set a1 = 107;
  suspend;
 end
 exception test_e1;
end
select a1 from real_a; -- will be 107, because apparently having a SUSPEND 
kills the savepoint, even though the exception is not caught

execute block returns (b integer) as
begin
 update real_a set a1 = 109;
 suspend;
 exception test_e1;
end
select a1 from real_a; -- will be 109: it's not about nested begin/end


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to