pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Peter Geoghegan <pg@heroku.com>
Cc: Francisco Olarte <folarte@peoplecall.com>
Cc: cwire4@gmail.com, "pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.
Date: Fri, 6 May 2016 11:20:40 -0700
Message-ID: <20160506182040.6bbpacq3ncj777ic@alap3.anarazel.de> (raw)
In-Reply-To: <CAM3SWZQwcH8Ebeq1ZvKYUOSAbFfuBmc9pcF0-u5f6Az0-oHLpw@mail.gmail.com>
References: <20160506065528.2693.64808@wrigleys.postgresql.org>
	<CA+bJJbz7Gydp+DRRe_sgV1d9hP_6PtqxzLBwxCAb8DyZxYmcrQ@mail.gmail.com>
	<CAM3SWZQwcH8Ebeq1ZvKYUOSAbFfuBmc9pcF0-u5f6Az0-oHLpw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2016-05-06 11:18:24 -0700, Peter Geoghegan wrote:
> On Fri, May 6, 2016 at 6:39 AM, Francisco Olarte <folarte@peoplecall.com> wrote:
> >> (previous successful key value + number of failed inserts)
> >> It seems to me that intuitively the key should only increment on a
> >> successful insert, not just an insert statement being executed.  For one,
> >> this unnecessarily reduces the keyspace available for the column.
> >
> > I suspect this is "working as designed". The same things happen if you
> > do a lot of inserts and then rollback a transaction. This is because
> > serial use sequences, which are not mean to generate exact correlative
> > values, but to a mean to generate unique keys with very high
> > concurrency.
> 
> It is. There have been several -bugs threads on this already. e.g.,
> the following two:
> 
> http://www.postgresql.org/message-id/flat/CAM3SWZQMfR6Zfe3A0Nr4ddko8xZrijAuQQ=EcGjGeJSs2piAXA@mail.g...
> 
> http://www.postgresql.org/message-id/flat/CAM3SWZS2jd1Ci2TR2bjBXqZgK3JdoFin9yGbC5TQdYdF12RBuA@mail.g...

Maybe we should add a note to the docs then?

Andres


-- 
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 (11+ messages)  latest in thread

Message-ID: <20160506182040.6bbpacq3ncj777ic@alap3.anarazel.de>
Permalink:  ../20160506182040.6bbpacq3ncj777ic@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20160506182040.6bbpacq3ncj777ic@alap3.anarazel.de

 · 

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: andres@anarazel.de, pg@heroku.com, folarte@peoplecall.com
  Subject: Re: BUG #14126: INSERT ON CONFLICT DO NOTHING auto increments serial primary key when no insert happens.
  In-Reply-To: <20160506182040.6bbpacq3ncj777ic@alap3.anarazel.de>
  References: <20160506065528.2693.64808@wrigleys.postgresql.org> <CA+bJJbz7Gydp+DRRe_sgV1d9hP_6PtqxzLBwxCAb8DyZxYmcrQ@mail.gmail.com> <CAM3SWZQwcH8Ebeq1ZvKYUOSAbFfuBmc9pcF0-u5f6Az0-oHLpw@mail.gmail.com> <20160506182040.6bbpacq3ncj777ic@alap3.anarazel.de>

* 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