model-writtenrun 2963 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Mikaƫl Gourlaouen reported that PostgreSQL 16 and 17 retained an unnecessary outer join that PostgreSQL 15 removed, with a reproducer involving a join condition spanning multiple tables #1; David Rowley identified the change that first exposed the regression #2.
- Tom Lane traced the failure to stale attr_needed bits after removing another join and initially proposed relaxing the removability check while restoring checks for pushed-down conditions, considering full reconstruction too expensive #3.
- Richard Guo demonstrated that the proposed shortcut could incorrectly remove a join whose columns were referenced through equivalence classes and prevent a valid removal involving a placeholder #4.
- Tom accepted those objections and chose to rebuild dependency information from equivalence classes, join clauses, lateral references, and placeholders while preserving relation-zero bits for targetlist and HAVING references; he remained concerned about backpatching the larger change #5.
- Tom posted the completed patch with a regression test and reported that a simple benchmark increased remove_useless_joins runtime from about 500 to 530 nanoseconds with barely any overall planner impact; the last thread message requested review and left backpatching undecided #6.
- The patch from #6 landed unchanged as a3179ab692, whose commit message explicitly deferred PostgreSQL 16 and 17 backpatches to allow testing on the development branch.