model-writtenrun 4485 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Lukas Eder reported that JSON_ARRAY over an empty query returned NULL instead of the standard-required empty array in #1, and Vik Fearing confirmed the violation in #2.
- Richard Guo traced the behavior to the internal JSON_ARRAYAGG rewrite in #3 and supplied a parser-side COALESCE fix with tests and documentation in #4.
- Tom Lane objected to changing application-visible behavior in stable releases and to exposing the aggregate rewrite in view dumps in #6; Richard agreed to a master-only fix preserving the original syntax in #7.
- After jian he questioned the subject's reference to JSON_VALUE in #8, Lukas clarified that the report concerned JSON_ARRAY in #9.
- Richard introduced a dedicated constructor type and planner-side query rewriting in #10, then refined empty-array constant construction in #11.
- Richard abandoned manual planner-side query construction as fragile in #12, instead building the executable expression through parse analysis and retaining the original query separately for view deparsing.
- Amit Langote endorsed the revised design and proposed clearer field documentation in #14 and #19, which Richard accepted in #20.
- Richard raised the post-freeze compatibility question in #16, Tom recommended consulting the release management team in #17, and Nathan Bossart and Melanie Plageman supported inclusion in version 19 in #24 and #25.
- Richard committed #12 as 8d829f5a02 with expanded comments and a catalog-version bump, announcing completion in #27.
- Ayush Tiwari demonstrated that the new empty-array fallback bypassed RETURNING varchar length restrictions, including through views, and identified the missing typmod enforcement in #28.
- Richard fixed the fallback constant and input-function call to use the result typmod, added length-restriction tests, and committed 9d124a14b3 directly from discussion, announcing it in #29.
- Staroverov Ilja reopened the thread with domain failures in #30: fallback constraints were checked prematurely and later constraint changes were ignored; his patch deferred fallback domain checks but explicitly left domains rejecting NULL unresolved.
- jian he supplied a replacement draft in #31 that aggregates in the domain's base type and applies domain coercion after COALESCE, also covering NOT NULL domains.
- Amit Langote endorsed Jian's approach in #32, requested Richard's thoughts, and said his continuing review would prevent committing before Saturday's release wrap.
- Amit supplied a revised patch in #33 with clearer comments, more direct domain coercion, and reorganized tests, crediting Jian and Ilya Staroverov; he limited the intended fix to version 19 and later and demonstrated that existing views retain the old behavior until recreated because no catalog-version bump is required.
- At #33, the original empty-array and typmod fixes have landed, while the domain fix remains uncommitted with Amit's revised patch awaiting further review.