Re: remove_useless_joins vs. bug #19560 - Mailing list pgsql-hackers

From Richard Guo
Subject Re: remove_useless_joins vs. bug #19560
Date
Msg-id CAMbWs48+9KEsnnNm9=BhFot_v8_9cPpPad1U9E1ynETxJ_kgzA@mail.gmail.com
Whole thread
In response to Re: remove_useless_joins vs. bug #19560  (Ayush Tiwari <ayushtiwari.slg01@gmail.com>)
Responses Re: remove_useless_joins vs. bug #19560
List pgsql-hackers
On Fri, Sep 25, 2026 at 8:43 PM Ayush Tiwari
<ayushtiwari.slg01@gmail.com> wrote:
> Would it make sense to skip PHVs during that argument walk too,
> while still processing other SubLinks in the argument? The attached
> patch tries that, with small tests for sum() and GROUPING().

Skipping PHVs in build_subplan looks right to me.  Any PHV found
within the arguments of an outer-level Aggref is a pushed-down copy
that its owning level has already preprocessed, so there is nothing
left to do in it.  The flag looks ugly though, but I don't have a
better fix than that.

I plan to push this fix soon if there are no objections.

- Richard



pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: Persist slot invalidations before publishing them
Next
From: Bertrand Drouvot
Date:
Subject: Re: Report relation extension blockers within parallel lock groups