Re: BUG #4307: INSERT fails with primary key contraint - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4307: INSERT fails with primary key contraint
Date
Msg-id 14674.1216164200@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4307: INSERT fails with primary key contraint  ("Oskars Ozols" <oskars.ozols@gmail.com>)
List pgsql-bugs
"Oskars Ozols" <oskars.ozols@gmail.com> writes:
> I have noticed that during high load Postgre starts to use old free sequence
> values (like 156112 in my sample). Sometimes it's ok, but sometimes it fails
> with error above.

This is fairly hard to believe; the sequence code was debugged years
ago.  Particularly seeing that your application is evidently supplying
the id value for itself in the INSERT (from a previous nextval, or perhaps
some other way?), it seems much more likely that there's a bug on the
application side.

If you'd like us to pursue this, please put together a self-contained
test case.  Assuming it's real, perhaps a simple custom script for
pgbench would serve to show the problem.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Oskars Ozols"
Date:
Subject: BUG #4307: INSERT fails with primary key contraint
Next
From: Gregory Stark
Date:
Subject: Re: BUG #4307: INSERT fails with primary key contraint