Subject | [firebird-support] Is it a Trigger Problem? |
---|---|
Author | Zoran |
Post date | 2019-07-17T14:46:44Z |
This might sound impossible...
I have one master and two detail tables. Relation is defined thru Foreign Key and cascade delete. When I insert a master row, the master table trigger inserts one empty detail row (only master key column populated)) in each of the two detail tables. So each master row has only one detail row in each of two detail tables and that doesn’t change during the life of a master row.
All works well. Very, very seldom my client gets two detail rows for the same master row. Sometimes it is in detail 1 table, sometimes it is in detail 2 table. There are 5 users updating and inserting new rows 8 hours a day. Database size is small (about 10,000 rows in the main table).
Application code does not insert any rows into detail tables, just updates them. There are several triggers in the database, but the only one that touches detail tables is the one in the master table.
Now crazy question. How is this possible? Is there any special circumstance in FB which might cause this?
Here is part of the trigger in master table:
if (INSERTING) then
begin
insert into "T_ORDERCUSTOMER" (OrderId) values (new.Id);
insert into "T_ORDERVEHICLE" (OrderId) values (new.Id);
…
Server: FB 3.4, Win 10 Pro, 12GB RAM
Workstations: Win 10 Home and Pro, 4-8GB RAM
Development: Delphi 10.3.1, Win 10 Ent, 32GB RAM
Tnx.