On Friday 09 December 2005 09:22, Jan Wieck wrote: > On 12/8/2005 9:12 PM, Luca Pireddu wrote: > > I wrote a trigger function with the intent of preventing the deletion of > > a parent record when a referencing record would not allow it. However, > > the result is that the referencing record stays, but the referenced one > > is gone, so that my foreign key constraint is not respected. The > > behaviour can be replicated with the following: > > You did something else than intended. You prevented deletion of the > referencing (dependent) record. That is where you defined the trigger, > and that is what renders the foreign key constraints DELETE operation > from dependent into a NOP. > > I guess that counts more as a pilot error. > > > Jan > Thanks for the clarification. I was working under the assumption that preventing the deletion would cause an error to be raised by the FK check. On a related note, I can achieve my intended behaviour by raising an exception in the trigger, rather than returning null. Luca