shawn everett <everett@pgweb.com> writes:
> Should I use a trigger or a rule? If I use a trigger how should it be
> written. If I use a rule how do I put two delete statements in it.
You can't use a trigger, because a trigger is fired at the point where
a physical tuple is about to be inserted/deleted/updated. The view has
no physical tuples, therefore nothing to fire a trigger on.
The problem with the rule, as you guessed, is that once you delete from
the first table there are no longer any matching tuples in the view
(which is what OLD is referring to), so second delete doesn't find any
matches. Perhaps Jan Wieck can think of a solution ... I'm not sure
how to do it.
regards, tom lane