model-writtenrun 4324 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Richard Guo reported a planner error caused by retaining cloned join clauses after removing a LEFT JOIN, and suggested changing RINFO_IS_PUSHED_DOWN to exclude cloned clauses #1 #2.
- Tom Lane rejected changing the shared macro because of possible side effects and suggested tracking clauses by their original join's serial numbers; Richard implemented that approach but questioned whether it captured every generated clause #3 #4.
- Tom replaced serial-number tracking with a smaller fix that expands the clause-removal test's relid set to include commutable outer joins, avoiding the additional bookkeeping #5.
- Richard supplied an example establishing the need for commute_above_r, supported moving joinrelids computation into remove_rel_from_query, and proposed asserting that a removable join has a nonzero outer-join relid #6.
- Tom committed the revised approach with the discussed refactoring, diagnostic assertions, and regression coverage as 7a844c77ec, explaining that existing tests already exercised the additional commutation case once assertions exposed it #7.
- The new assertions helped Richard discover that join removal could incorrectly delete a still-needed placeholder, triggering assertion failures and losing lateral dependencies in non-assert builds, with wrong query results #8.
- Richard proposed an inline guard preserving placeholders evaluated above the removed join #9; Tom adopted it with regression tests in 9a2dbc614e and confirmed the fix #10.
- Richard closed the open item after the second fix landed, leaving both reported problems resolved at the end of the thread #11.