model-writtenrun 3538 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Michał Kłeczek reported that UNION ALL branches containing constant years produced invalid remote ORDER BY clauses through postgres_fdw, and also described wanting redundant ordering removed for foreign partitions #1.
- David Rowley proposed skipping Const equivalence members in appendOrderByClause() and attached the initial fix #2; Ashutosh Bapat suggested considering deparseConst() for consistency and requested regression coverage #3.
- David retained constant elimination as the less risky fix, deferred any GROUP BY constant elimination to separate development work, and added two tests plus simpler delimiter handling in the revised patch #4.
- Richard Guo reviewed the revised patch favorably while questioning equivalence-class redundancy checks and non-Const pseudoconstants #5; David explained why UNION ALL creates the relevant constant child members and why literal Const nodes cause the ordinal-position ambiguity #6.
- David committed #4 as c399248b3b with comment clarification, test aliases, and a dedicated ORDER BY test section, backpatching the fix through PostgreSQL 12.
- After the commit, Ashutosh renewed his suggestion to unify ORDER BY deparsing, accepting that this could be limited to the development branch; the bug fix had landed, while that broader cleanup remained a proposal #7.