Re: duplicate key violates unique on a nextval() field

From: Peter Warasin <peter(at)endian(dot)com>
To: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: duplicate key violates unique on a nextval() field
Date: 2011-08-30 17:28:25
Message-ID: 4E5D1DB9.8020704@endian.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

thank you for answering!

On 30/08/11 18:56, Scott Ribe wrote:
>> But how can that happen when it is bigserial?
>
> Postgres only assigns the value if it is not explicitly provided. Any client, freeradius included, could be assigning ids and could have bugs. Allowing pg to assign the value is safe, using nextval is safe--I'd look for client code that tries to get ranges ahead of time & cache...

freeradius is not supplying an id.
that field is left away as it should be in order to use nextval

that renders the whole thing strange.. also because it happens only from
time to time.
it must be related to load. when the system is under heavy load
something goes wrong and 2 concurrent transactions get the same unique
id. but how??

peter

--
:: e n d i a n
:: security with passion

:: peter warasin
:: http://www.endian.com :: peter(at)endian(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2011-08-30 17:32:30 Re: COPY failure on directory I own
Previous Message Pavel Stehule 2011-08-30 17:25:26 Re: out of memory - no sort