Commit 7cca5f5
fix(query): prevent stack overflow in CTE processing with recursive annotations (#18588)
fix(query): add recursive annotations to prevent stack overflow in CTE processing
Adds #[recursive::recursive] annotations to key CTE binding functions to prevent
stack overflow when processing complex queries with many UNION operations.
This follows the pattern established in PR #18268 and addresses the
segmentation fault issue introduced in PR #18577.
Fixes:
- bind_query() - Main query binding entry point
- m_cte_to_temp_table() - CTE temporary table creation
- compute_cte_ref_count() - CTE reference counting
- bind_cte_definition() - CTE definition binding
- TableNameReplacer visitor methods - AST traversal for name replacement
The recursive library automatically grows stack size when needed,
preventing stack overflow on deeply nested or complex query structures.
Co-authored-by: Ubuntu <[email protected]>1 parent 97ecd7f commit 7cca5f5
File tree
2 files changed
+6
-0
lines changed- src/query/sql/src/planner/binder
- bind_query
- bind_table_reference
2 files changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
| 214 | + | |
212 | 215 | | |
213 | 216 | | |
214 | 217 | | |
| |||
345 | 348 | | |
346 | 349 | | |
347 | 350 | | |
| 351 | + | |
348 | 352 | | |
349 | 353 | | |
350 | 354 | | |
| |||
356 | 360 | | |
357 | 361 | | |
358 | 362 | | |
| 363 | + | |
359 | 364 | | |
360 | 365 | | |
361 | 366 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| |||
0 commit comments