Issue Details (XML | Word | Printable)

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

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

Error in autonomous transaction with empty exception handler: can insert duplicate values into PK/UK column (leads to unrestorable backup)

Created: 09/Feb/11 05:32 AM   Updated: 04/Jun/13 12:39 PM
Component/s: None
Affects Version/s: 3.0 Initial, 2.5.0
Fix Version/s: 2.5.1

Time Tracking:
Not Specified

Issue Links:
Relate

Planning Status: Unspecified


 Description  « Hide
Let the file 'AAA' contains the following script:

recreate table tmp(id int not null primary key using index tmp_id_pk);
commit;
set transaction no wait isolation level read committed;
set term ^;
execute block as
begin
  insert into tmp values(1);
  insert into tmp values(2);
  in autonomous transaction do begin
     insert into tmp values(1);
     when any do begin
        --exception; -- <<<<<<<<<<<<<< ATTENTION: **NO** handle exception here
     end
  end
end^
set term ;^
commit;
select id from tmp;
select count(*) from tmp;
commit;

Create NEW EMPTY database, connect to it via ISQL -n and then:

SQL> IN AAA;

Result:

          ID
============
           1
           2
           1


       COUNT
============
           3

So, we have duplicate in PK. The same result will be if PK replaced by UK.
--------------------------------------
Moreover,
1) GFIX -V -FULL will *NOT* alert that table TMP has some problem in it's PK;
2) gbak -b will create UNRECOERABLE .fbk.
If then we'll try gbak -c test.fbk test_new.fdb then following messages will fills the screen:
...
...
gbak: The unique index has duplicate values or NULLs.
gbak: Delete or Update duplicate values or NULLs, and activate index with
gbak: ALTER INDEX "TMP_ID_PK" ACTIVE;
gbak:Index "TMP_ID_PK" failed to activate because:
gbak: The unique index has duplicate values or NULLs.
gbak: Delete or Update duplicate values or NULLs, and activate index with
gbak: ALTER INDEX "TMP_ID_PK" ACTIVE;
gbak:Index "TMP_ID_PK" failed to activate because:
gbak: The unique index has duplicate values or NULLs.
gbak: Delete or Update duplicate values or NULLs, and activate index with
gbak: ALTER INDEX "TMP_ID_PK" ACTIVE;

... etc ... (these messages repeats infinitely)


 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
Firebird #52322 Wed Feb 09 10:47:42 GMT+00:00 2011 dimitr Simplified fix for CORE-3340 (Error in autonomous transaction with empty exception handler: can insert duplicate values into PK/UK column) and its cousin CORE-3341 (Events might not be posted inside the autonomous transaction). It's actually the same bug with different visible effects.
Files Changed
MODIFY /firebird/branches/B2_5_Release/src/jrd/exe.cpp

Repository Revision Date User Message
Firebird #52324 Wed Feb 09 10:59:24 GMT+00:00 2011 dimitr Fixed CORE-3340 (Error in autonomous transaction with empty exception handler: can insert duplicate values into PK/UK column).
Files Changed
MODIFY /firebird/trunk/src/dsql/Nodes.h
MODIFY /firebird/trunk/src/jrd/exe.cpp

Repository Revision Date User Message
Firebird #52326 Wed Feb 09 21:26:18 GMT+00:00 2011 asfernandes Fixed hang found with CORE-3340 test-case.
Files Changed
MODIFY /firebird/trunk/src/dsql/StmtNodes.cpp
MODIFY /firebird/trunk/src/dsql/Nodes.h
MODIFY /firebird/trunk/src/jrd/exe.cpp

Repository Revision Date User Message
Firebird #52668 Tue Apr 05 05:13:49 GMT+00:00 2011 dimitr One more part of the fix for CORE-3340.
Files Changed
MODIFY /firebird/branches/B2_5_Release/src/jrd/exe.cpp

Repository Revision Date User Message
Firebird #52672 Tue Apr 05 05:49:40 GMT+00:00 2011 dimitr One more part of the fix for CORE-3340.
Files Changed
MODIFY /firebird/trunk/src/dsql/StmtNodes.cpp

Repository Revision Date User Message
Firebird #58141 Tue Jun 04 12:39:31 GMT+00:00 2013 makowski QA-455 for CORE-3340
Files Changed
ADD /qa/fbt-repository/trunk/tests/bugs/core_3340.fbt