Re: BUG #14114: FK on-delete-cascade trouble - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14114: FK on-delete-cascade trouble
Date
Msg-id 27918.1461680327@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14114: FK on-delete-cascade trouble  (zha-vova@yandex.ru)
List pgsql-bugs
zha-vova@yandex.ru writes:
> After creating a FK constraint with "on delete cascade" option I got a
> problem with before-delete-trigger on a dependent table. This short listing
> below will make it clear:

This is not a bug, this is expected behavior.  If you have a trigger that
interferes with the updates commanded by a foreign key cascade query,
you'll break the integrity of the FK.  The only way we could prevent that
is to not run triggers for FK cascade updates; which is a cure worse than
the disease, since there are plenty of legitimate reasons why you'd want
a table's triggers to fire.

Write your triggers more carefully.

            regards, tom lane

pgsql-bugs by date:

Previous
From: zha-vova@yandex.ru
Date:
Subject: BUG #14114: FK on-delete-cascade trouble
Next
From: andreas.schmidt1982@googlemail.com
Date:
Subject: BUG #14115: PostgreSQL stopped listening to ip address