Re: Rename EXISTS-to-ANY converted subplan to exists_to_any

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Rename EXISTS-to-ANY converted subplan to exists_to_any
Date: 2026-06-18 02:14:53
Message-ID: 1186947.1781748893@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
> I think this is an improvement rather than a bug fix. However, since the
> subplan name is user-visible in EXPLAIN/PLAN_ADVICE and can also be
> referenced by pg_plan_advice in v19, it seems better to make this
> adjustment before v19 is released rather than ship the current naming
> and change it later in v20. Thoughts?

This changes user-visible behavior, but we already changed that since
v18. I checked this case:

create table alt_t1(a int, b int);
create table alt_t2(a int, b int);
explain SELECT * FROM alt_t1 WHERE EXISTS (SELECT 1 FROM alt_t2 WHERE alt_t2.a = alt_t1.a) OR alt_t1.a < 0;

v18 says

Seq Scan on alt_t1 (cost=0.00..7896.89 rows=1507 width=8)
Filter: ((ANY (a = (hashed SubPlan 2).col1)) OR (a < 0))
SubPlan 2
-> Seq Scan on alt_t2 (cost=0.00..32.60 rows=2260 width=4)

HEAD says

Seq Scan on alt_t1 (cost=0.00..7896.89 rows=1507 width=8)
Filter: ((ANY (a = (hashed SubPlan exists_2).col1)) OR (a < 0))
SubPlan exists_2
-> Seq Scan on alt_t2 (cost=0.00..32.60 rows=2260 width=4)

So if we wait till v20 then v19 will be unlike both the previous and
following releases. Probably better to change only once.

IIRC, Robert is responsible for the change we have now, so looping
him in to see if he's got any objections to changing it again.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haibo Yan 2026-06-18 02:27:18 Re: [PATCH] Proposal to Enable/Disable Index using ALTER INDEX
Previous Message Fujii Masao 2026-06-18 01:51:46 Re: Rename EXISTS-to-ANY converted subplan to exists_to_any