model-writtenrun 7323 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Zhiyong Wu reported a PostgreSQL 14.1 optimizer crash triggered by a deeply nested recursive WITH query using SEARCH, supplying a reproducer and AddressSanitizer trace #1.
- Kyotaro Horiguchi reduced the reproducer, identified problems involving implicit SEARCH columns and indirect recursive references, and proposed rejecting those references during parsing while expressing uncertainty about the fix #2.
- After several months, Tom Lane identified missing ctelevelsup checks in rewriteSearchAndCycle() as the reason nested CTEs with identical names were confused, and replaced the parser patch with scope-aware matching and an explicit error when the recursive reference cannot be found at the required level #3.
- At the thread's last message, Tom Lane reported that his replacement caught all examples in the thread and bug #17318; supporting these indirect recursive references remained a possible future enhancement #3.
- The following day, Tom Lane's replacement patch #3 landed unchanged as f819020d40, completing the crash fix while retaining the explicit unsupported-case error.