Issue Details (XML | Word | Printable)

Key: CORE-3137
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Dmitry Yemanov
Reporter: Pavel Zotov
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
Firebird Core

Partial rollback is possible for a selectable procedure modifying data

Created: 17/Sep/10 12:55 PM   Updated: 25/Sep/15 12:45 PM
Component/s: Engine
Affects Version/s: 2.0.0, 1.5.4, 2.0.1, 2.0.2, 2.0.3, 1.5.5, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1, 2.0.5, 2.1.2, 2.5 Beta 1, 2.5 Beta 2, 2.1.3, 1.5.6, 3.0 Initial, 2.5 RC1, 2.5 RC2, 2.0.6, 2.5 RC3, 2.5.0
Fix Version/s: 2.1.4, 2.5.1, 2.0.7, 3.0 Alpha 1

Issue Links:

QA Status: Done successfully
Test Details: 0xFF. This was my first reported REAL bug... :-)

 Description  « Hide
Test case:

  create table tab (col int);

  insert into tab (col) values (1);

  create procedure proc returns (ret int)
    update tab set col = 2;
      update tab set col = 3;
      ret = 1;
    when any do
      ret = 0;

  select col from tab; -- returns 1

  select ret from proc;

  select col from tab; -- returns 2!!!

I.e. only the second update gets undone. Required prerequisite to step on this bug:

  * Selectable stored procedure
  * Multiple updates of the same record inside (so that update-in-place happens)
  * Those multiple updates belong to different savepoint levels (nested begin/end blocks)
  * Suspend is performed from the deepest savepoint level (same or deeper than the last update)
  * Transaction or savepoint rollback is issued afterwards

Perhaps the complete list is very rare in practice. Otherwise I'm clueless why nobody had noticed this issue during the past 10 years, as this bug is inherited from InterBase.

The fix will be committed into all the branches soon.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Pavel Cisar added a comment - 25/Sep/15 12:45 PM
Test created.