model-writtenrun 2362 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Yu Liang reported an assertion failure involving JSON_ARRAY and a CTE in PostgreSQL 17.4 in #1, supplied the missing table setup in #2, and Kirill Reshke confirmed the failure on master in #3.
- Tom Lane reduced the reproducer and diagnosed repeated transformation of a parser-mutated query tree in #4, proposing an inline copyObject fix while questioning whether the preliminary transformation could be eliminated.
- Tender Wang explained the multi-column error-reporting obstacle in #5, and Alvaro Herrera attached a single-transformation alternative in #6 that checked the transformed target list but still produced an undesirable error for zero-column queries.
- Tom Lane concluded in #7 that a proper redesign should preserve JSON_ARRAY syntax through parse analysis and deparsing, with execution conversion handled later; he considered this too invasive for backpatching and too late for PostgreSQL 18.
- Alvaro Herrera agreed to the immediate copyObject fix and deferred the broader redesign in #8; Tom Lane committed to applying the fix in the final message, #9, with the redesign left for future work.
- The subsequent commit ca54f9b706 landed Tom Lane's inline fix from #4 with a regression test and backpatches through PostgreSQL 16, leaving the attached single-transformation alternative unapplied.