model-writtenrun 4273 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Markus Winand reported a wrong-varnullingrels error involving a lateral subquery with a CTE in #1, and Richard Guo reproduced it without a CTE and traced it to outer-join identity 3 leaving stale nulling bits on lateral references in #2.
- Richard proposed intersecting nestloop parameters' nulling bitmaps with the available outer relations in #3, and Markus confirmed that this fixed both his reduced example and original query in #4.
- Tom Lane argued in #5 that the adjustment should be restricted to process_subquery_nestloop_params() to avoid masking unrelated bugs, supplied that revision, and removed equality assertions that would become difficult to maintain.
- Richard endorsed Tom's revision in #6, and Tom committed #5 unchanged as bfd332b3fd, announcing the push in #7.
- Richard then found that Memoize cache keys retained separate copies of the same problematic lateral references and supplied an incremental fix in #8; Tom committed it with comment edits as 63e4f13d2a and announced the result in #10.
- Richard demonstrated remaining failures involving TABLESAMPLE, functions, XMLTABLE, and VALUES in #11, showing that subquery-specific fixes were insufficient; he also identified an assertion failure caused by outer-join relids entering lateral_relids through PlaceHolderVars.
- Tom agreed in #12 that the fixes were in the wrong place, then supplied a three-patch replacement in #13 that reverted the specialized code while retaining its tests, restored centralized adjustment in identify_current_nestloop_params(), and separately removed outer-join relids from lateral dependency sets.
- The last message, #13, left that replacement proposed with explicit concern that centralized adjustment weakens nullingrel cross-checks, but Tom considered the alternatives unattractive with beta2 approaching.
- On the following day, 0655c03ef9 combined the first two patches of #13 without implementation changes, replacing the earlier specialized fixes and adding a function-reference regression test.
- The remaining patch from #13 landed unchanged as efeb12ef0b, completing the submitted series while leaving a more rigorous treatment of nestloop nullingrel checks as future work.