model-writtenrun 9028 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby reported a PostgreSQL 12 planner error when grouping and joining partitioned data in #1, then supplied a self-contained FULL JOIN reproducer with partitionwise join and aggregation enabled in #5.
- Tom Lane reproduced the failure in #6 and identified missing EquivalenceClass members for partitionwise child joins in #7, connecting the bug to earlier work in thread #40873.
- Justin emphasized that a query working in PostgreSQL 11 now failed in PostgreSQL 12 in #9; Tom promised a fix for 12.1 and considered reverting the optimization responsible, despite its performance benefits for large partition sets, in #10.
- Amit Langote explained that the equivalence-class fix could stand independently of broader partitionwise-join changes and submitted development-branch and PostgreSQL 12 patches in #11, avoiding a full revert.
- Tom found incorrect nullable-relid handling and an unjustified early exit in #12; Amit addressed both in #13, using adjust_child_relids_multilevel and documenting why callers supply mapping information.
- Tom rejected premature joinrel registration and side effects used to populate joinrel eclass_indexes in #14, while David Rowley explained why those indexes should remain confined to simple relations in #15; Amit consequently introduced a separate child-join equivalence routine in #16.
- Tom revised the patch in #17 to consider equivalence classes mentioning any relation of the join, avoiding dependence on the chosen join-input pair, and moved the regression test onto existing partition_join tables to reduce test cost.
- Amit supplied the PostgreSQL 12 adaptation in #18, questioned redundant partitionwise-enable checks, and proposed additionally suppressing partially translated multi-relation expressions; Tom accepted removing the checks but declined the extra optimization because those expressions might still be useful and offered little expected savings in #19.
- Tom committed the HEAD patch from #17 as 529ebb20aa with light cleanup and removal of redundant guards, and announced its PostgreSQL 12 backport in #19; the planner-error fix was complete, while broader multiway-join planning work in thread #40873 remained open and Amit agreed to rebase it in #20.