Add regression test for recursive CTE referenced from another recursive CTE#107358
Conversation
…ve CTE Issue ClickHouse#89844: a query with an inner recursive CTE (d) that is referenced from the recursive member of an outer recursive CTE (t) aborted with LOGICAL_ERROR "UNION query d is not recursive: While executing RecursiveCTESource". Root cause (fixed by 6afcb7c): RecursiveCTEChunkGenerator located the self-referencing table nodes by storage id via collectTableNodesWithStorage. During execution updateStorage() rewrites those table nodes' storage ids to point at fresh temporary tables; when the inner CTE was re-executed while the outer CTE recursed, the stored RecursiveCTETable storage id no longer matched any table node, the collected set came up empty, and the constructor raised the "is not recursive" LOGICAL_ERROR. The fix matches by the stable temporary table name (CTE name) instead. The fix shipped without a regression test. Verified both directions on a local debug build: the two queries abort with the LOGICAL_ERROR before 6afcb7c and return the expected results after it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Workflow [PR], commit [637b70a] Summary: ✅ AI ReviewSummaryThis PR adds a focused stateless regression test for issue Final VerdictStatus: ✅ Approve |
|
@rienath that failure is not from this PR's test. The 04336 is broken only on macOS arm_darwin right now: 4 fails today across 4 unrelated PRs (#107300, #107339, #107358, #107362), OK everywhere else (Fast test amd 75x, amd_debug 157x, arm_binary 164x). Its |
|
CI fully finished on |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 803 line(s), 81 function(s) across 130 file(s) · Details Top files
|

Related: #89844
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Regression test only, for #89844 (a recursive CTE referenced from another recursive CTE's recursive member used to raise
LOGICAL_ERROR "UNION query d is not recursive"). Fixed by 6afcb7c; that fix had no test. Verified the queries abort before the fix and return the expected results after.cc @rienath
Version info
26.6.1.763