Search Postgresql Archives

Re: rule which unpredictable modify a sequence number

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

 



Armand Turpel <armand.turpel@xxxxxxxxxxxxxx> writes:
> I have a problem with a rule which unpredictable modify a sequence 
> number. When I add a new table entry, the new id_keyword hasnt the value 
> as expected. ex.: 1000000000000000, 1000000000000001, 
> 1000000000000002,...... If i remove the rule it works.

Rules don't play very nicely together with volatile functions like
nextval().  The rule is just a macro, and so if you have multiple
references to new.id_keyword, that means multiple evaluations of
nextval().

You'd be better off using a trigger to do this, I think.

			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