Subject Re: [firebird-support] Question on Ref Integrity during Trigger
Author Helen Borrie
At 12:32 PM 8/10/2005 -0700, Myles Wakeham wrote:
>I am attempting to update a separate table with data in the AFTER INSERT
>phase of a trigger. But there is a foreign key constraint on the table I
>wish to create new records in, as a result of the insert into the table with
>the trigger. This constraint requires that the data in the table I'm
>updating already be in existence.
>Hence when I go to create the additional records in the related table, I get
>a 'Violation of foreign key constraint' as I can't insert new records in
>this table that reference the record I'm creating. I guess its because that
>record hasn't actually been saved when the trigger is firing?

Myles, this description is too vague and ambiguous. Provide the key
structures of the two tables, together with the definitions of the keys.

>Anyway what is the trick here? Do I have to manually drop the foreign key

No. Let's get a clear picture of the situation here.