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-04-30T19:07:30Z
Lists: pgsql-general
> On 30 Apr 2026, at 6:42 PM, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> 
> So I'd say that the documentation is not quite accurate.  Really, the DELETE does not place
> a row lock on the row.
> 
> That must account for the behavior difference: after the SELECT ... FOR UPDATE, the
> INSERT ... ON CONFLICT interprets the row lock as a conflict and moves on, while in the
> DELETE case it sees no conflict (yet), but has to wait for the transaction to complete before
> it knows how to proceed.
> 
> I cannot say if that is intentional; as I said initially, I am surprised too.

Thank you for your additional insights, Laurenz.

Kind regards,
Matt