Search Postgresql Archives

Re: Update rule on a view - what am I doing wrong

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Leif Jensen <leif@xxxxxxxxxxx> 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 record per row in the top table. To be able to update on this view I have created a rule 'on update'. The rule needs to have both 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux