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 02:33:23
Message-ID: CAMbWs49H275KzgZr3Cd1Hy+6Lmwp35bZ+5PrVc62k3HDLj6hNQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Jul 19, 2026 at 3:11 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Pushed.

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.

- Richard

Attachment Content-Type Size
v1-0001-Skip-unnecessary-get_relids_in_jointree-when-ther.patch application/octet-stream 2.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-07-20 02:35:28 Re: BUG #19553: Wrong results from nested LEFT JOINs over an empty subquery (regression since v16)
Previous Message Peter Geoghegan 2026-07-19 19:53:48 Re: BUG #17949: Adding an index introduces serialisation anomalies.