Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING - Mailing list pgsql-general

From Matt Magoffin
Subject Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING
Date
Msg-id 93ADF4E5-CF49-4347-8A79-33655A8E0299@msqr.us
Whole thread
In response to Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING
List 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

pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING
Next
From: Laurenz Albe
Date:
Subject: Re: Confirmation on concurrent SELECT FOR UPDATE with ON CONFLICT DO NOTHING