"Jefim Matskin" <JefimM(at)sphera(dot)com> writes:
> Following sample demonstrates incorrect behavior of the trigger.
> The problem happens only when the table that has the trigger also has foreign key constraints.
What makes you think this is a bug? It looks to me like you simply
haven't thought about the interaction between your AFTER DELETE trigger
and the triggers that implement the foreign-key behavior (in particular,
the ON UPDATE CASCADE and ON DELETE CASCADE clauses).
regards, tom lane