From: Joao Rito <joaovictor.rito@gmail.com>
To: Tender Wang <tndrwang@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org, Alperen Keles <alpkeles99@gmail.com>
Subject: Re: BUG #19798: failed to build any 4-way joins
Date: Sun, 15 Nov 2026 00:08:32 -0300
Message-ID: <20261115030832.1908-1-joaovictor.rito@gmail.com> (raw)
In-Reply-To: <CAHewXNkpyvue6dx5Q33mHXnTh4uxDHHAw0szbwGCBnyZwHThpA@mail.gmail.com>
References: <CAHewXNkpyvue6dx5Q33mHXnTh4uxDHHAw0szbwGCBnyZwHThpA@mail.gmail.com>
Hi Tender,
I tested your patch on current master (81b2179b492, built with cassert and tap tests) and it applies cleanly. On master the reproducer from the report (ROLLUP over a LATERAL subquery that references the nullable side of a LEFT JOIN) fails with "failed to build any 4-way joins", and two more variants I wrote fail with the same error, one of them also with "failed to build any 5-way joins". With the patch all of them run, and for the cases where I wrote an equivalent UNION ALL query (the reproducer and two of the variant queries), the results match. The regress suite passes (243 tests).
What I did not test: other forms such as CUBE, GROUPING SETS and RIGHT JOIN (I only ran the cases above), the isolation and tap suites, pgindent, the docs, the back branches, other platforms (I ran one Linux build), and the effect on plan quality or planning time.
Small suggestions: the patch has no regression test, so it could add one with the reproducer to join.sql or groupingsets.sql. I have no objection to the change in joinrels.c from what I could test.
Regards,
Joao Rito
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: joaovictor.rito@gmail.com, tndrwang@gmail.com, alpkeles99@gmail.com
Subject: Re: BUG #19798: failed to build any 4-way joins
In-Reply-To: <20261115030832.1908-1-joaovictor.rito@gmail.com>
References: <CAHewXNkpyvue6dx5Q33mHXnTh4uxDHHAw0szbwGCBnyZwHThpA@mail.gmail.com> <20261115030832.1908-1-joaovictor.rito@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox