[expr] Placeholder inference for CASE statements
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Is your feature request related to a problem or challenge?
Placeholder inference should work for CASE expressions, i.e.
```sql
-- Simple CASE with placeholders
SELECT CASE department_id WHEN $1 THEN 'Match' ELSE 'No match' END FROM employees;
-- Searched CASE with placeholders
SELECT CASE WHEN salary > $1 THEN $2 ELSE $3 END FROM employees;
-- CASE with placeholder as base expression
SELECT CASE $1 WHEN 'Engineering' THEN 'Eng' ELSE 'Other' END;
```
### Describe the solution you'd like
`Expr::infer_placeholder_types` should infer the data types of placeholders for CASE expressions.
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start by reading Expr::infer_placeholder_types and trace how it handles CASE expressions and placeholder types. Use the three SQL examples in the issue as coverage cases; done means placeholders in simple CASE, searched CASE, and CASE-base expressions receive inferred data types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100