Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wJzMl-000TPZ-1C for pgsql-general@arkaria.postgresql.org; Mon, 04 May 2026 19:54:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wJzMj-008gvO-2n for pgsql-general@arkaria.postgresql.org; Mon, 04 May 2026 19:54:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wJzMj-008gvF-1b for pgsql-general@lists.postgresql.org; Mon, 04 May 2026 19:54:05 +0000 Received: from pmg-2.outbound.snap.net.nz ([202.37.100.107]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wJzMe-00000000VKP-20aF for pgsql-general@lists.postgresql.org; Mon, 04 May 2026 19:54:05 +0000 Received: from pmg-2.snap.net.nz (localhost.localdomain [127.0.0.1]) by pmg-2.snap.net.nz (Proxmox) with ESMTP id CA097393BA4; Tue, 5 May 2026 07:53:52 +1200 (NZST) Received: from smtp.snap.net.nz (smtp.snap.net.nz [202.37.100.140]) by pmg-2.snap.net.nz (Proxmox) with ESMTP id D630D38F6DE; Tue, 5 May 2026 07:53:50 +1200 (NZST) Received: from x24.msqr.us (msqr.us [123.255.47.99]) by rupert.snap.net.nz (Postfix) with ESMTPS id CD56512D3; Tue, 5 May 2026 07:53:50 +1200 (NZST) Received: from smtpclient.apple (unifi.localdomain [192.168.1.1]) (authenticated bits=0) by x24.msqr.us (8.18.2/8.16.1) with ESMTPSA id 644JrngB008439 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 5 May 2026 07:53:49 +1200 (NZST) (envelope-from postgresql.org@msqr.us) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=msqr.us; s=20121026; t=1777924430; bh=PXTSFKM+qsXHstoHkiAvRCKoiI4Fg8pG4LQUA8lFPwE=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=HiRAmYPk9j7HHqaEzWmy/jjpwhMuknwCMt3d9VK9fzlKA5Eua8aCbw7K0KWPAQEc9 ksrNOXj7cEEq3GabOqm17u43JrNIp/tzwnrNrTEl+kFyp5VyqwqraxFj47UFpKgvRd Tvl9LLlgnRx/vjwcfjK/EdW+OG0BrznbD9tOb4xY= X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 1.5.2 at msqr.us Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81.1.6\)) Subject: Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING From: Matt Magoffin In-Reply-To: <83819e975523be4d320141ff1363dfb40c82289b.camel@cybertec.at> Date: Tue, 5 May 2026 07:53:39 +1200 Cc: Adrian Klaver , pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <0B23DB17-EB6B-4B56-9A61-D7A35A039DA2@msqr.us> References: <087DA595-FB65-49F4-89E9-AE9F5CBF6E4C@msqr.us> <8BCF50C4-D36B-4453-9B09-AA717AE6F563@msqr.us> <93ADF4E5-CF49-4347-8A79-33655A8E0299@msqr.us> <83819e975523be4d320141ff1363dfb40c82289b.camel@cybertec.at> To: Laurenz Albe X-Mailer: Apple Mail (2.3826.700.81.1.6) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 1 May 2026, at 7:35=E2=80=AFAM, Laurenz Albe = wrote: >=20 > Also, the behavior difference only occurs with ON CONFLICT DO NOTHING. > If you use ON CONFLICT ... DO UPDATE ..., the update will block. > That makes the behavior difference somewhat less bad in my eyes. Yes, I had noticed that as well. In my case my goal is to both block and = =E2=80=9Cdo nothing=E2=80=9D if after blocking a matching row is found. = If this behaviour isn=E2=80=99t expected, I thought I could change to ON CONFLICT DO UPDATE SET id =3D EXCLUDED.id to essentially =E2=80=9Cdo nothing=E2=80=9D but I thought I would incur = an actual update and I wanted to avoid the churn I presumed that would = include. Kind regards, Matt=