pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: John R Pierce <pierce@hogranch.com>
Cc: dsrich@dsrich.net
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13507: INSERT into tables with SERIAL primary keys failing about half of the time
Date: Tue, 21 Jul 2015 09:40:45 -0400
Message-ID: <28061.1437486045@sss.pgh.pa.us> (raw)
In-Reply-To: <55ADF703.60606@hogranch.com>
References: <20150721003929.9707.40340@wrigleys.postgresql.org>
	<55ADF703.60606@hogranch.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

John R Pierce <pierce@hogranch.com> writes:
> On 7/20/2015 5:39 PM, dsrich@dsrich.net wrote:
>> This query (and three other versions  using DEFAULT and 'RETURNING payeenum'
>> clauses) fails about half the time with payees_pkey constraint violation.

> when you create a column of pseudotype SERIAL, it creates a SEQUENCE.  

Yeah.  Have you checked whether the last_value of the sequence is above
the maximum value in the payeenum column?  It's not terribly hard to get
that out-of-sync, unfortunately, typically by loading data with
predetermined serial values.

The sequence is probably named payees_payeenum_seq, but psql's \d on
the payees table would show you for sure.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)

Message-ID: <28061.1437486045@sss.pgh.pa.us>
Permalink:  ../28061.1437486045@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28061.1437486045@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pierce@hogranch.com, dsrich@dsrich.net
  Subject: Re: BUG #13507: INSERT into tables with SERIAL primary keys failing about half of the time
  In-Reply-To: <28061.1437486045@sss.pgh.pa.us>
  References: <20150721003929.9707.40340@wrigleys.postgresql.org> <55ADF703.60606@hogranch.com> <28061.1437486045@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox