model-writtenrun 2667 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Jason Smith reported a PostgreSQL 17.2 connection-terminating crash from a UNION combining numeric and integer columns in #1.
- Tom Lane traced the crash to a numeric comparator receiving integer values in #2, then established that UNION pathkeys were pushed below the required datatype conversion in #3.
- Richard Guo proposed an inline fix that checked the ordering operator's input type in #4, and explained why EXPLAIN concealed the implicit cast in #5.
- David Rowley explained how cost comparisons retained an unnecessary child sort and duplicate output columns prevented Merge Append in #6; Tom considered that optimization issue nonurgent in #9.
- David attached a simpler fix using SetOperationStmt.colTypes in #7; Tom endorsed rejecting datatype mismatches rather than adapting pathkeys across types in #8, and Richard agreed with the simpler lookup in #10.
- David committed 2310064510 from #7, removing the redundant sortop check and adding an assertion and explanatory comments; his announcement in #11 explained the existing callback protection, promised the fix in PostgreSQL 17.3, and supplied an explicit-cast workaround.
- Jason acknowledged the completed fix in #12; no attached patch remained pending, while the unnecessary-sort optimization was left for future work.