Re: PlaceholderVars and join removal with appendrel parents

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Arne Roland <arne(dot)roland(at)malkut(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PlaceholderVars and join removal with appendrel parents
Date: 2026-07-14 07:02:37
Message-ID: CAMbWs4-fTg1j6S+HLgXzMcbJaQ8DKjWBMw=mg6hakdTynFaqZg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 13, 2026 at 7:23 PM Arne Roland <arne(dot)roland(at)malkut(dot)net> wrote:
> My idea would be to put a bitmapset into remove_rel_from_query with the
> seen ones and recurse removing it from the rinfo. I attached a sketch of
> my idea. But maybe our have a better one.

Thanks for the report and the patch. I think the fix is on the right
track. (BTW, the seen_serials bitmap is to avoid processing any join
clause more than once, the same trick used in rebuild_joinclause_attr_needed.)

I've made some cosmetic tweaks to the patch, added a commit message,
and included a test case, as attached. I plan to push this soon,
barring any objections.

- Richard

Attachment Content-Type Size
v2-0001-Strip-removed-relation-references-from-PHVs-in-jo.patch application/octet-stream 7.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-07-14 07:07:02 Re: RFC: Logging plan of the running query
Previous Message shveta malik 2026-07-14 06:17:25 Re: REASSIGN OWNED vs. relisshared dep on !relisshared