Inconsistent behavior regarding visibility of master record on detail inserts
-----------------------------------------------------------------------------

                 Key: CORE-6138
                 URL: http://tracker.firebirdsql.org/browse/CORE-6138
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 2.5.9, 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0
            Reporter: Carlos H. Cantu


During a master-detail insert using two different transactions, where the 
detail transaction is snapshot, FB allows the detail insert even when the 
master record is not visible for the detail transaction. It can be easily 
reproduced with the following steps:

Open two isql sessions (isql1 and isql2) connected to the same database, and 
follow the sequence of commands in this order:

isql1:
CREATE TABLE A
 (
 ID BIGINT NOT null PRIMARY KEY);

 CREATE TABLE B
 (
 ID BIGINT NOT null PRIMARY KEY,
 ID_A BIGINT NOT NULL
 );

 ALTER TABLE B ADD constraint FK_B__A FOREIGN KEY(ID_A) REFERENCES A(ID) ON 
UPDATE CASCADE ON DELETE CASCADE;

 commit;
 INSERT INTO A (ID) VALUES (1);

isql2:
 commit; -- to be sure that if there is active transaction, it will be ended now
 select * from a; -- just to be sure that snapshot transaction is started now

isql1:
 commit;

isql2:
 INSERT INTO B (ID, ID_A) VALUES (1, 1); -- This SHOULD break, since master is 
not visible for this transaction, but FB will accept it
 -- Any trigger based action against the master record will have null effect, 
but the detail insert will not fail!
 commit;

PS: For people with business rules on triggers, this behavior may lead to wrong 
results.

-- 
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

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to