Re: remove_useless_joins vs. bug #19560

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tender Wang <tndrwang(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Jacob Brazeal <jacob(dot)brazeal(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: remove_useless_joins vs. bug #19560
Date: 2026-09-19 13:14:35
Message-ID: CAMbWs4_CsfOstpFR3yj_3=-YpV-65Fr_Y3DM2+bGR1vW3OMnvA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 16, 2026 at 1:56 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> I think we have to insist that the preprocessing happens after join
> alias expansion, which is what my v2 patch in [1] did. But that patch
> was not complete: as I explained in [2], it doesn't handle copies that
> were pushed into a SubLink's subselect. I think we can cover those by
> also running the preprocessing in preprocess_expression, right before
> SS_process_sublinks. That way each upper-level PHV is preprocessed
> exactly once, at the level it belongs to, and always after join alias
> expansion.
>
> Hence, the attached fix.

I've pushed this patch and back-patched it to v16.

- Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nick Ivanov 2026-09-19 13:48:30 Re: Possible race condition in pg_basebackup
Previous Message Alexander Lakhin 2026-09-19 13:00:00 Re: Regression tests failures due to concurrent grants