Subject | Re: [firebird-support] accessing data from the trigger & ON DELETE CASCADE |
---|---|
Author | Ann W. Harrison |
Post date | 2004-12-06T16:13:40Z |
At 11:00 AM 12/5/2004, Valentin Samko wrote:
parent before it begins deleting related records from the child
table. A before delete record in the child executes after the
parent is gone.
could change your implementation so a before delete trigger in the
parent table deletes the related records in the child table. In
general, such triggers are less reliable than equivalent constraints
but in this case the triggers have two advantages. First, they do
what you want. Second, you can do both - define both a before
delete trigger on the parent table and an "on delete cascade" foreign
key relationship between the tables.
Regards,
Ann
>I have found a bug in my program where a few database tables are notA foreign key with "on delete cascade" causes the delete of the
>updated properly due to Firebird unable to access certain data from
>the trigger.
parent before it begins deleting related records from the child
table. A before delete record in the child executes after the
parent is gone.
>I do not know whether this is the expected behaviour or not, and if itYes, it's expected and no, it's not configurable, directly. You
>is configurable (I really hope so).
could change your implementation so a before delete trigger in the
parent table deletes the related records in the child table. In
general, such triggers are less reliable than equivalent constraints
but in this case the triggers have two advantages. First, they do
what you want. Second, you can do both - define both a before
delete trigger on the parent table and an "on delete cascade" foreign
key relationship between the tables.
Regards,
Ann