model-writtenrun 3555 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- PetSerAl reported that coalesce and nullif in FROM could silently accept a column definition list shorter than the returned record, although comparable queries correctly rejected the mismatch #1.
- David G. Johnston questioned column definition lists for polymorphic functions #2 #4, while Tom Lane and PetSerAl clarified that the resolved RECORD return type requires such a list regardless of polymorphism #3 #6.
- Tom Lane reproduced version-dependent failures and an assertion crash when the declared list was too long #3, then traced the missing validation to ExecInitFunctionScan trusting a tuple descriptor extracted from a folded RECORD expression instead of the caller's column definitions #8.
- Tom Lane proposed prioritizing the column definition list rather than reverting earlier expression-type improvements, and investigated inline_set_returning_function for similar assumptions #8; his attached patch implemented that approach, removed the assertion, aligned the optimizer code, and tested mismatched column counts and types #9.
- jian he reviewed the patch's description of tuple compatibility checks and cited older PostgreSQL behavior #10; Tom Lane retained the comment's reference to ExecMakeTableFunctionResult for maintainability and continued weighing compatibility risks against the risks of leaving the bug unfixed #11.
- The patch landed unchanged on the development branch as 2ed8f9a01e, while the separately supplied candidate 466376c9f8 is its PostgreSQL 12 backport, retaining the executor fix and tests but omitting the optimizer consistency change from #9.
- In the final reply, Tom Lane confirmed that the original fix was pushed and backpatched because leaving it unfixed seemed riskier; he also declined to pursue David G. Johnston's separate anonymous-record expansion example because inferring runtime row structure during parsing would fail in too many cases #5 #12.