Skip to main content

relation_contains_subquery

Function relation_contains_subquery 

Source
fn relation_contains_subquery(expr: &HirRelationExpr) -> bool
Expand description

Returns whether expr contains any subquery (HirScalarExpr::Exists or HirScalarExpr::Select). Both the relation tree and the per-node scalars are traversed iteratively, so this is stack-safe on deeply nested inputs: a long JOIN/CTE chain grows the relation tree, and a flat CASE with many arms lowers to a deep right-nested If chain in a single scalar. visit_pre on HirScalarExpr stops at Exists/Select (they are scalar leaves), so the scan never descends into subquery bodies. The relation walk already yields those bodies as its own children.