Luca Pireddu <luca@cs.ualberta.ca> writes:
> 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.
[ shrug... ] So don't do that. Triggers can break FK constraints in any
number of ways beside this one (eg, changing the data in the record).
If we tried to prevent that I think we'd either waste a lot of cycles or
cripple the trigger feature ... quite possibly both.
regards, tom lane