Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBdwX-0008Na-KR for pgsql-general@arkaria.postgresql.org; Wed, 13 Jul 2022 15:06:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oBdwW-0001VY-7L for pgsql-general@arkaria.postgresql.org; Wed, 13 Jul 2022 15:06:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBdwV-0001Uw-TH for pgsql-general@lists.postgresql.org; Wed, 13 Jul 2022 15:06:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBdwT-0005na-J8 for pgsql-general@lists.postgresql.org; Wed, 13 Jul 2022 15:06:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 26DF6KII2230613; Wed, 13 Jul 2022 11:06:20 -0400 From: Tom Lane To: =?utf-8?Q?Andr=C3=A9_H=C3=A4nsel?= cc: pgsql-general@lists.postgresql.org Subject: Re: Issues with upserts In-reply-to: <034701d896c8$fe2edfa0$fa8c9ee0$@webkr.de> References: <032201d896bd$7a948a10$6fbd9e30$@webkr.de> <034701d896c8$fe2edfa0$fa8c9ee0$@webkr.de> Comments: In-reply-to =?utf-8?Q?Andr=C3=A9_H=C3=A4nsel?= message dated "Wed, 13 Jul 2022 16:58:20 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2230611.1657724780.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 13 Jul 2022 11:06:20 -0400 Message-ID: <2230612.1657724780@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =3D?utf-8?Q?Andr=3DC3=3DA9_H=3DC3=3DA4nsel?=3D writes: > This will yield =E2=80=9C8=E2=80=9D, showing that new sequence numbers h= ave 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