Search Postgresql Archives

Re: duplicate sequence, it is possible?

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

 



On Monday 19 September 2011 08:19:18 Alban Hertroys wrote:
> On 19 Sep 2011, at 2:57, Anibal David Acosta wrote:
> > Hi everyone.
> > 
> > I have a table with a PK, this table has a lot of insert per second (100
> > ~ 150 insert /sec) Sometimes, a get a duplicate key error, but ID is
> > generated from a function (VOLATILE). This function has just one line
> > (select nextval('XXX'))
> > 
> > Is possible that this function return same ID for two diff call?
> > 
> > Postgres version is 9.0
> > 
> > Thanks!
> 
> Very unlikely.
> Are you certain that you're not just hitting pre-existing rows that have
> ID's higher than the starting ID of your sequence? Or that there isn't
> another process inserting rows without using the sequence?

Also, why wrap nextval('XXX') instead of using it directly ? Unless your 
function does more than "select nextval('XXX')", you're just making your code 
harder to read and slightly slower.

-- 
Vincent de Phily

-- 
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