model-writtenrun 3295 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Drew Kimball reported that procedures with polymorphic output parameters could fail with an anyelement display error, while an anyarray example appeared to work #1.
- Dmitry Dolgov proposed rejecting these procedure declarations #2, but Tom Lane traced the problem to unresolved types in CALL's result descriptor and argued that the procedures themselves were valid #3.
- Tom retained build_function_result_tupdesc_t() to preserve output column names and replaced its declared types with resolved stmt->outargs types in #4.
- For PostgreSQL 12/13, Tom supplied an adaptation that expands arguments and identifies output positions through proargmodes; he avoided moving argument expansion into parsing because third-party code might depend on the existing behavior #5.
- The initial fix landed unchanged as f535f350c1 from #4, with the older-branch implementation landing unchanged as 70ffb27b23 from #5.
- After those commits, Dmitry confirmed successful testing on master and PostgreSQL 13 #6, and Tom explained why procedures return tuples while a function with one output parameter uses that parameter's type directly #7.
- Andrew Bille subsequently reported a PostgreSQL 12 crash when a SQL procedure returned an integer where polymorphic resolution required numeric, with newer versions unaffected #8; Tom acknowledged the branch-specific failure #9.
- Tom diagnosed missing polymorphic return-type validation and posted a separate executor fix that preserves ABI compatibility and produces a clean error on PostgreSQL 12 #10; he declined to backpatch the larger coercion changes already present in newer versions and proposed adding the regression case there too.
- The final message left that follow-up patch proposed #10; the supplied commits show it subsequently landed unchanged for PostgreSQL 12 as 4208f44c94, while 7515982636 added only the regression coverage with successful coercion expected on newer versions.