Re: BUG #13846: INSERT ON CONFLICT consumes sequencers on conflicts - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #13846: INSERT ON CONFLICT consumes sequencers on conflicts
Date
Msg-id 20160105161326.GD7650@awork2.anarazel.de
Whole thread Raw
In response to BUG #13846: INSERT ON CONFLICT consumes sequencers on conflicts  (paul@salesintel.com)
Responses Re: BUG #13846: INSERT ON CONFLICT consumes sequencers on conflicts
Re: BUG #13846: INSERT ON CONFLICT consumes sequencers onconflicts
List pgsql-bugs
On 2016-01-05 15:02:27 +0000, paul@salesintel.com wrote:
> The following bug has been logged on the website:
>
> Bug reference:      13846
> Logged by:          Paul Hester
> Email address:      paul@salesintel.com
> PostgreSQL version: 9.5rc1
> Operating system:   Windows 10 Pro
> Description:
>
> When using an INSERT statement with an ON CONFLICT clause, if there is a
> conflict, and the table being inserted into has a column defaulted to
> nextval('seq'), the sequencer 'seq' is always incremented. This can quickly
> and artificially consume all values of the sequencer; it behaves as if
> conflict detection happens after inserts are attempted, rather than before.

Yes. That's by design. You can't reliably do conflict detection before
evaluating column default values.

Andres Freund

pgsql-bugs by date:

Previous
From: gnkna@yahoo.co.in
Date:
Subject: BUG #13847: WARNING: skipping "pg_toast_" --- cannot vacuum indexes, views, or special system tables VACUUM
Next
From: Peter Geoghegan
Date:
Subject: Re: BUG #13846: INSERT ON CONFLICT consumes sequencers on conflicts