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