Re: Is this expected concurrency behaviour for EvalPlanQual and ctid? - Mailing list pgsql-general

From Bernice Southey
Subject Re: Is this expected concurrency behaviour for EvalPlanQual and ctid?
Date
Msg-id CAEDh4nx9Hx_pm4rCvGhWjgzy_w9qR7Ydiha+D4mchddHZPft7A@mail.gmail.com
Whole thread Raw
In response to Re: Is this expected concurrency behaviour for EvalPlanQual and ctid?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, Nov 19, 2025 at 8:04 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> > The same thing happens with
> > update t set  i = 2 from (select i from t for update) x where t.i = x.i;
>
> Right, the common advice if you need to make such scenarios work
> is to add FOR UPDATE to the non-target relations.  But here, that
> just breaks in the opposite direction: the sub-select blocks
> waiting for the concurrent commit and then returns x.i = 2.
> But the UPDATE's initial scan of t only sees t.i = 1, so the join
> fails before we ever get to EvalPlanQual.

Thanks for the clear explanation. When I tried to think this through I
couldn't fill in the details.



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Is this expected concurrency behaviour for EvalPlanQual and ctid?
Next
From: Hu Bert
Date:
Subject: postgresql-17 on debian bookworm - directories missing