-
Notifications
You must be signed in to change notification settings - Fork 860
Open
Labels
C-bugCategory: something isn't workingCategory: something isn't working
Description
Repro
SELECT 'a' LIKE 'a' ESCAPE '';Actual
The query fails with an internal panic:
Code: 1104
called `Option::unwrap()` on a `None` value
Panic site:
src/query/sql/src/planner/semantic/type_check.rs:5378
Expected
Databend should reject an empty ESCAPE string with a normal SQL error, or define valid behavior for it. It must not panic during planning.
Why this looks like the root cause
resolve_like() assumes the escape string has at least one character:
escape.chars().next().unwrap()at:
src/query/sql/src/planner/semantic/type_check.rs:5375src/query/sql/src/planner/semantic/type_check.rs:5378
When escape == "", next() returns None, so the planner panics before returning a user-facing error.
Impact
panic.logshows this family occurred 2 times in one migration batch.- Any generated or user-written query with
ESCAPE ''can crash the planner path.
Suggested fix direction
- Validate
ESCAPElength before callingconvert_escape_pattern() - Return a semantic error for zero-length or multi-character escape strings
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: something isn't workingCategory: something isn't working