Subject Bug with Foreign Keys?
Author Rodrigo Bravo
Hello forum,
We've found an unusual behavior in Firebird 1.5 (a violation of foreign
key). These cases have been tested successfully on Firebird 1.0.3. Properties
of the transactions are: "read commited", "record version" and "no wait".

MASTER TABLE:
ID - INTEGER - PRIMARY KEY
NAME - VARCHAR(40)

DETAIL:
ID - INTEGER - PRIMARY KEY
ID_MASTER - INTEGER - FOREIGN KEY (with ID from MASTER)
DESCRIPTION - VARCHAR(50)


CASE 1:
----------------------------------------------------------------
TRANSACTION 1:
- UPDATE MASTER SET NAME = 'new_name' WHERE ID = 10;

TRANSACTION 2:
- UPDATE DETAIL SET NAME = 'Detail of updated record'
WHERE ID = 381; (and ID_MASTER = 10, obviously)

Result: SUCCESS on FB 1.5 Final Release (for Win32 and Linux) and FB 1.0.3.


CASE 2:
----------------------------------------------------------------
TRANSACTION 1:
- UPDATE MASTER SET NAME = 'new_name' WHERE ID = 10;

TRANSACTION 2:
- INSERT INTO DETAIL (ID, ID_MASTER, DESCRIPTION) VALUES
(382, 10, 'Detail of the updated record');

Result: SUCCESS on FB 1.0.3, BUT on Firebird 1.5 Final Release "lock conflict
on no wait transaction. VIOLATION OF FOREIGN KEY constraint "FK_DETAIL1"
on table "DETAIL" (under Windows or Linux we've obtained the same result).

Some people in other Firebird Forums told us to report this error to you.
Thanks for your support.


Rodrigo Bravo - rodrigobravo@...
Santiago Fernández - santiagofernandez1@...
Santa Fe - Argentina.