apache / apache/datafusion-sqlparser-rs

Parameterized queries

Open
#291 11 comments 3 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

This fails to parse, but it can be successfully executed by SQLite (after providing a value for the parameter):

```
#[test]
fn go() {
use sqlparser::dialect::SQLiteDialect;
use sqlparser::parser::Parser;

let sql = "select * from test_table where test_column = ?;";

let dialect = SQLiteDialect {}; // or AnsiDialect, or your own dialect ...

let ast = Parser::parse_sql(&dialect, sql).unwrap();

println!("AST: {:#?}", ast);
}
```

Any idea why I get this error message?:

_called `Result::unwrap()` on an `Err` value: ParserError("Expected an expression, found: ?")
thread 'dynamic_queries::go' panicked at 'called `Result::unwrap()` on an `Err` value: ParserError("Expected an expression, found: ?")',_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure through Parser::parse_sql with SQLiteDialect and the parameterized query shown in the issue. Read the parser's expression handling around the `?` token and review the comment thread for the intended parameter representation. Done means the supported dialect behavior is clarified or implemented and covered by a regression test for this query.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
compilers, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.