Re: Is this expected concurrency behaviour for EvalPlanQual and ctid?

From: Bernice Southey <bernice(dot)southey(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Is this expected concurrency behaviour for EvalPlanQual and ctid?
Date: 2025-11-20 10:33:00
Message-ID: CAEDh4nx9Hx_pm4rCvGhWjgzy_w9qR7Ydiha+D4mchddHZPft7A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 19, 2025 at 8:04 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hu Bert 2025-11-20 11:35:28 postgresql-17 on debian bookworm - directories missing
Previous Message Tom Lane 2025-11-19 20:04:18 Re: Is this expected concurrency behaviour for EvalPlanQual and ctid?