Search Postgresql Archives

Re: Update view/table rule order of operations or race condition

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

 



Dan Fitzpatrick <dan@xxxxxxxxxxxxx> writes:
> The rule is creating a new value from the sequence a_a_id_seq for  
> "new.options_id" on each UPDATE call. How do I use the variable  
> new.options_id in the three update statements without incrementing the  
> sequence again?

You don't.  This is one of the major disadvantages of rules: they're
macros, not functions, and as such don't have any real local variables.
You should probably look into whether you can do what you want with a
trigger instead of a rule.

			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