Re: BUG #19553: Wrong results from nested LEFT JOINs over an empty subquery (regression since v16)

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, leis(at)in(dot)tum(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19553: Wrong results from nested LEFT JOINs over an empty subquery (regression since v16)
Date: 2026-07-20 03:23:36
Message-ID: CAMbWs49je3+J0x+fsNZJJN4FHq20_W2LXJS=J9y80k=9kYR5Sw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jul 20, 2026 at 11:35 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> > It occurred to me that we can skip the new get_relids_in_jointree()
> > scan altogether when there are no PHVs anywhere in the query
> > (root->glob->lastPHId==0), since then the find_dependent_phvs() checks
> > are no-ops anyway. This is also consistent with how we check
> > root->glob->lastPHId in find_dependent_phvs() and
> > find_dependent_phvs_in_jointree(). Attached is a trivial patch doing
> > that.

> WFM.

Thanks! Pushed.

- Richard

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-07-20 09:44:27 BUG #19560: Wrong results since v16: removable LEFT JOIN silently drops WHERE qual
Previous Message Alena Vinter 2026-07-20 02:46:01 Re: pg_rewind WAL segments deletion pitfall