Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING
Matt Magoffin <postgresql.org@msqr.us>
From: Matt Magoffin <postgresql.org@msqr.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>,
pgsql-general@lists.postgresql.org
Date: 2026-05-04T19:53:39Z
Lists: pgsql-general
> On 1 May 2026, at 7:35 AM, Laurenz Albe <laurenz.albe@cybertec.at> wrote: > > 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 “do nothing” if after blocking a matching row is found. If this behaviour isn’t expected, I thought I could change to ON CONFLICT DO UPDATE SET id = EXCLUDED.id to essentially “do nothing” but I thought I would incur an actual update and I wanted to avoid the churn I presumed that would include. Kind regards, Matt