Re: Remove no-op PlaceHolderVars

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove no-op PlaceHolderVars
Date: 2026-01-21 08:18:00
Message-ID: CAMbWs4-qJGVHLonakB+5C_DvhA0i7Wua4StzG4n0F42i+dB+oA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 16, 2026 at 11:49 AM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> Attached is a draft patch for the code changes. It currently causes
> plan changes in 28 regression test queries, which is a surprisingly
> high number. We'll have to go through these tests one by one, but
> before doing that, I would like to hear others' thoughts on this
> patch.

I went through those tests one by one, and AFAICS the plan changes are
all positive.

However, these plan changes resulted in a loss of coverage in tests
specifically designed to verify the planner's handling of PHVs. So
I've modified the affected queries to force the preservation of PHVs
by changing the target expressions into forms that the new logic
considers "unsafe to strip". Please see attached.

- Richard

Attachment Content-Type Size
v3-0001-Remove-no-op-PlaceHolderVars.patch application/octet-stream 19.8 KB
v3-0002-Fixing-test-cases.patch application/octet-stream 50.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Steven Niu 2026-01-21 08:18:41 Re: file_fdw: Support multi-line HEADER option.
Previous Message zengman 2026-01-21 08:12:42 Re: tuple radix sort