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

From Richard Guo
Subject Re: BUG #19553: Wrong results from nested LEFT JOINs over an empty subquery (regression since v16)
Date
Msg-id CAMbWs49H275KzgZr3Cd1Hy+6Lmwp35bZ+5PrVc62k3HDLj6hNQ@mail.gmail.com
Whole thread
In response to Re: BUG #19553: Wrong results from nested LEFT JOINs over an empty subquery (regression since v16)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Sun, Jul 19, 2026 at 3:11 AM Tom Lane <tgl@sss.pgh.pa.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

pgsql-bugs by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: BUG #17949: Adding an index introduces serialisation anomalies.
Next
From: Richard Guo
Date:
Subject: Re: BUG #19553: Wrong results from nested LEFT JOINs over an empty subquery (regression since v16)