Skip to content

Add a recursion limit to the evaluation of type_expr & parse_expr#2935

Merged
mamcx merged 2 commits into
masterfrom
mamcx/recursion-limit-expr
Jul 28, 2025
Merged

Add a recursion limit to the evaluation of type_expr & parse_expr#2935
mamcx merged 2 commits into
masterfrom
mamcx/recursion-limit-expr

Conversation

@mamcx
Copy link
Copy Markdown
Contributor

@mamcx mamcx commented Jul 11, 2025

Description of Changes

Add a guard against stack overflow in case of nested expression and joins.

API and ABI breaking changes

None

Expected complexity level and risk

1

Testing

  • Find how deep can be recursed the affected functions and put a limit on it
  • Add a extra test to prove we can (in theory) do lots of joins in the planning steps, even if executing them will be slow

@mamcx mamcx requested a review from joshua-spacetime July 11, 2025 22:20
@mamcx mamcx self-assigned this Jul 11, 2025
@mamcx mamcx added the release-any To be landed in any release window label Jul 11, 2025
Comment thread crates/core/src/sql/execute.rs Outdated
Comment thread crates/core/src/sql/execute.rs Outdated
Comment thread crates/core/src/sql/execute.rs Outdated
Comment thread crates/core/src/sql/execute.rs Outdated
Comment thread crates/core/src/sql/execute.rs Outdated
Comment thread crates/expr/src/check.rs Outdated
Comment thread crates/sql-parser/src/parser/errors.rs Outdated
Comment thread crates/sql-parser/src/parser/recursion.rs Outdated
Comment thread crates/sql-parser/src/parser/mod.rs Outdated
@mamcx mamcx force-pushed the mamcx/recursion-limit-expr branch 3 times, most recently from 5df9037 to 9e0e9d9 Compare July 16, 2025 17:52
Comment thread crates/expr/src/lib.rs Outdated
Comment thread crates/expr/src/lib.rs Outdated
Comment thread crates/expr/src/lib.rs Outdated
Comment thread crates/sql-parser/src/parser/errors.rs
Comment thread crates/sql-parser/src/parser/mod.rs Outdated
Comment thread crates/sql-parser/src/parser/recursion.rs Outdated
Comment thread crates/sql-parser/src/parser/recursion.rs
Comment thread crates/expr/src/statement.rs Outdated
Comment thread crates/core/src/sql/execute.rs Outdated
Comment thread crates/core/src/sql/execute.rs
@mamcx mamcx force-pushed the mamcx/recursion-limit-expr branch 2 times, most recently from e77fea7 to e92d223 Compare July 17, 2025 20:33
@mamcx mamcx force-pushed the mamcx/recursion-limit-expr branch 3 times, most recently from cbeabbc to f136ec0 Compare July 24, 2025 16:46
@mamcx mamcx force-pushed the mamcx/recursion-limit-expr branch from f136ec0 to 18ae75e Compare July 28, 2025 15:04
@mamcx mamcx enabled auto-merge July 28, 2025 15:04
@mamcx mamcx added this pull request to the merge queue Jul 28, 2025
Merged via the queue into master with commit b54a4e4 Jul 28, 2025
23 of 24 checks passed
mamcx added a commit that referenced this pull request Aug 26, 2025
)

# Description of Changes

Add a guard against `stack overflow` in case of nested expression and
`joins`.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing
- [x] Find how `deep` can be recursed the affected functions and put a
limit on it
- [x] Add a extra test to prove we can (in theory) do lots of `joins` in
the planning steps, even if executing them will be slow
@bfops bfops deleted the mamcx/recursion-limit-expr branch May 6, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants