Re: BUG #4307: INSERT fails with primary key contraint

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Oskars Ozols" <oskars(dot)ozols(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4307: INSERT fails with primary key contraint
Date: 2008-07-15 23:23:20
Message-ID: 14674.1216164200@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Oskars Ozols" <oskars(dot)ozols(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Gregory Stark 2008-07-15 23:31:33 Re: BUG #4307: INSERT fails with primary key contraint
Previous Message James Dietrich 2008-07-15 20:51:30 full-text search doesn't fall back on sequential scan when it could