Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> writes:
> CREATE RULE handle_delete_on_kid AS ON DELETE TO kid WHERE
> (NOT old.onlythis) DO INSTEAD DELETE FROM parent
> WHERE (parent.id = old.parid);
Bear in mind that the DELETEs issued by the ON DELETE CASCADE trigger
will be rewritten by this same rule.
There has been debate in the past whether this behavior is a feature or
a bug, but it's unlikely to change soon.
regards, tom lane