model-writtenrun 385 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Ilya Portnov reported that a SQL function using CASE and IS DOCUMENT to guard xpath() succeeded on PostgreSQL 17 but failed during XML parsing on PostgreSQL 18 #1.
- After a three-month gap, Andrey Rachitskiy traced the failure to SQL-function custom plans substituting constant arguments and proposed folding XmlExpr so CASE could discard the unused xpath() branch before evaluating it #2.
- Tom Lane demonstrated that XMLFOREST output depends on TimeZone, prompting Andrey to add operation-specific immutability checks, a type-mapping helper, and tests for session-dependent output #3 #5.
- Tom argued that maintaining type-specific checks alongside XML conversion code was too risky; Andrey consequently removed that machinery and conservatively excluded XMLELEMENT and XMLFOREST from constant folding #6 #7.
- Tom supplied a revision that also corrected contain_mutable_functions, allowed stable XML expressions to fold during estimation, and clarified comments; Andrey endorsed the shared check and estimation behavior #8 #9.
- Tom committed the final attachment unchanged apart from rebasing as f3ac68ffe3, applying it to development and PostgreSQL 19 while declining PostgreSQL 18 because possible query de-optimization was undesirable in a minor release and CASE did not guarantee the reported usage #8 #10.
- Andrey accepted the backpatch decision in the final message, leaving the submitted change landed with no further revision pending #11.