model-writtenrun 5298 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexey Borzov reported that MERGE inside a CTE produced a confusing error in PostgreSQL 15beta2 because the grammar accepted an unsupported construct #1.
- Tom Lane reproduced a parser assertion failure and proposed disallowing the construct for PostgreSQL 15 #2; Richard Guo identified missing handling in parsing and rewriting but agreed that rejection was appropriate for now #3.
- Alvaro Herrera submitted a CTE rejection guard and regression test, explaining that useful MERGE-in-CTE support would also need RETURNING and was beyond PostgreSQL 15's scope #4.
- Tom requested an error pointer at MERGE #5, but Alvaro found that the statement nodes lacked location information and also discovered the same unsupported usage through COPY #6; Tom agreed that adding location fields solely for this was unwarranted #7.
- Alvaro extended the patch to reject MERGE in COPY, retaining the available CTE location hint #8; Tom and Richard approved this final version #9 #10.
- The thread ended with those approvals, and Alvaro subsequently committed the final patch unchanged as 92af9143f1, completing the rejection fix while leaving full MERGE support in these contexts for future work.