Re: BUG #19765: Wrong result from a chain of LEFT JOINs since v16

From: Nitin Motiani <nitinmotiani(at)google(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Tender Wang <tndrwang(at)gmail(dot)com>, leis(at)in(dot)tum(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19765: Wrong result from a chain of LEFT JOINs since v16
Date: 2026-10-21 10:29:55
Message-ID: CAH5HC95m+4wqqMoma-r2EyFJTCGEHjjf4SLo3+U6-DLDhuAzQg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I'm attaching the rebased patch.

On Sat, Oct 17, 2026 at 1:05 PM Nitin Motiani <nitinmotiani(at)google(dot)com> wrote:
>
> On Fri, Oct 16, 2026 at 8:34 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> >
> > I think we can fix this by only making the TRUE dummy for clauses that
> > are not clones. For a clone, just throw the original clause back, as
> > v15 and earlier did.
> >
>
> I had first tried this change and it worked but for one of the tests
> in join.sql, it also added a redundant filter.
>

I am also attaching a patch with this simpler approach you suggested.
(v2-0001-Keep-all-cloned-outer-join-clauses.patch.txt). This keeps the
original clause for all clones. It also changes one existing plan in
join.out, where a redundant "Join Filter: (tt3.f1 = tt4.f1)" appears.

And I'm attaching the rebased patch for my narrower check from v1
(v2-0001-Keep-cloned-outer-join-clauses-only-where-needed.patch). This
keeps the original clause only if the clone is incompatible with
another outer join whose commute_below_l is non-empty). No changes to
existing regression output.

Please take a look and let me know which alternative seems better to you.

Thanks & Regards,
Nitin Motiani
Google

Attachment Content-Type Size
v2-0001-Keep-all-cloned-outer-join-clauses.patch.txt text/plain 6.6 KB
v2-0001-Keep-cloned-outer-join-clauses-only-where-needed.patch application/x-patch 7.3 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Ayush Tiwari 2026-10-21 10:03:47 Re: BUG #19774: Incremental backup loses re-extended blocks when WAL summaries are merged out of LSN order