Re: Issues with upserts - Mailing list pgsql-general

From Tom Lane
Subject Re: Issues with upserts
Date
Msg-id 2230612.1657724780@sss.pgh.pa.us
Whole thread Raw
In response to RE: Issues with upserts  (André Hänsel <andre@webkr.de>)
List pgsql-general
=?utf-8?Q?Andr=C3=A9_H=C3=A4nsel?= <andre@webkr.de> writes:
> This will yield “8”, showing that new sequence numbers have been generated for each attempt.

Well, yeah, because the INSERT has to be attempted first, and
that includes forming the whole candidate row including the
nextval() result.  If you're expecting a serial ID column to not
have holes in the sequence of values, you're going to be sadly
disappointed, whether you use ON CONFLICT UPDATE or not.

            regards, tom lane



pgsql-general by date:

Previous
From: André Hänsel
Date:
Subject: RE: Issues with upserts
Next
From: "David G. Johnston"
Date:
Subject: Re: Issues with upserts