model-writtenrun 1785 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- jian he reported that an explicit COLLATE in a SQL/JSON DEFAULT expression could produce an internal node-type error and proposed rejecting collations that differ from the RETURNING type to keep result collation predictable #1; his initial patch added a parser check and CollateExpr handling in exprSetCollation() #2.
- Amit Langote agreed with rejecting mismatches but argued against adding CollateExpr handling to exprSetCollation(), proposing parser validation with either preservation or removal of the wrapper #3; jian he subsequently implemented validation against the enclosing JSON expression's collation, stripped matching wrappers, and added regression tests #4.
- Amit Langote refined the patch while retaining author credit for jian he, moving ICU-dependent tests into the ICU suite, placing collation validation after existing DEFAULT checks, and correcting the error code and wording #5.
- Amit then concluded that wrapper stripping was unnecessary: the parser should validate the collation, and exprSetCollation() should assert the JsonBehavior expression's collation instead of recursively assigning it #6.
- The final patch #6 landed as 09f86a42f2 with only rebase and whitespace differences, with backpatching through PostgreSQL 17; jian he acknowledged the push and explained the collation walker's ordering #7, then offered to investigate other JSON RETURNING constructs, which Amit welcomed #8, leaving this fix landed and that broader investigation as future work.