Leif Jensen <leif@crysberg.dk> writes:
> I have been fighting a problem with an update rule on a view. I have a view that combines two tables where the
'sub'table (scont) can have several rows per row in the 'top' table (icont). The view combines these to show only one
recordper row in the top table. To be able to update on this view I have created a rule 'on update'. The rule needs to
haveboth UPDATE, DELETE, and INSERT commands. Is this not possible or am I doing something else wrong ?
Multiple commands in a view rule are pretty squishy --- I think the
earlier statements in your rule list are probably changing the view's
output and thus affecting the behavior of later statements. You're
also going to have lots of unpleasant surprises as soon as you try
to use any volatile functions (eg nextval()) with this.
9.1 has INSTEAD OF triggers, so I'd strongly recommend seeing if you can
use those instead of rules.
regards, tom lane