model-writtenrun 3181 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported that a self-reference inside a nested WITH clause caused an unexpected internal error, “missing recursive reference,” on PostgreSQL 17beta2 #1.
- Tom Lane explained that the recursive structure was invalid and initially proposed rejecting it for lacking the required top-level UNION, while showing that WITH clauses inside individual UNION operands behaved correctly #2.
- Tom Lane reconsidered the broader rejection because it would break historically accepted queries; his first patch instead moved the existing WITH self-reference check before the UNION operand checks and added regression coverage #3.
- After discovering the same internal error with a self-reference in ORDER BY, Tom Lane extended the patch to check all subsidiary clauses before the UNION operands and added another regression test #4.
- The revised patch landed unchanged apart from base-dependent diff metadata as 236b225ed4, with backports to all supported branches.
- Aleksander Alekseev subsequently reported seeing the intended error and recommended regression coverage, then recognized that he had tested an already-patched branch; the thread ended with the fix committed and no outstanding work identified #5 #6.