model-writtenrun 7350 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Zhiyong Wu reported an AddressSanitizer crash in PostgreSQL 14.1 while planning a recursive CTE containing nested UNIONs and a CYCLE clause #1.
- Tom Lane reduced the reproducer and questioned whether the failure reflected an optimizer bug or inadequate enforcement of the documented restriction on nested UNIONs #2.
- Dmitry Dolgov explained that the existing restriction covered chained UNIONs and proposed extending validation to nested subqueries #3.
- Dmitry Dolgov submitted parser validation using a CteState flag and two regression tests, reporting that tests passed while expressing uncertainty about the approach; he also noted that Kyotaro Horiguchi’s separate proposed fix did not catch this reproducer #4.
- The supplied discussion ends with the parser proposal unresolved #4; Tom Lane subsequently addressed the reported failure through the later patchset #682730 in thread #71104, committed as f819020d40, which checks CTE nesting depth and rejects unsupported recursive-reference locations during SEARCH/CYCLE rewriting without adopting this thread’s parser patch.