Re: BUG #19798: failed to build any 4-way joins

From: Joao Rito <joaovictor(dot)rito(at)gmail(dot)com>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, Alperen Keles <alpkeles99(at)gmail(dot)com>
Subject: Re: BUG #19798: failed to build any 4-way joins
Date: 2026-11-15 03:08:32
Message-ID: 20261115030832.1908-1-joaovictor.rito@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message shihao zhong 2026-11-15 03:33:17 Re: bug: Gather rescan keeps the first scan's tuple bound in workers
Previous Message Joao Rito 2026-11-14 21:33:56 Re: Two issues with REFRESH MATERIALIZED VIEW CONCURRENTLY