apache / apache/datafusion-sqlparser-rs

Add support for LIMIT prepared query

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

Description

Hi, I am using sqlparser 0.4.0 and rust version 1.36.0

Sql Query
`
SELECT "emp"."id" FROM "emp" WHERE "emp"."id" = $1 LIMIT $2 -- binds: [123, 5]
`

Parse error
`
ParserError("Expected literal int, found: $2")
`

Used Dialect:
```rust
impl Dialect for AckoPostgresSqlDialect {
fn is_identifier_start(&self, ch: char) -> bool {
(ch >= 'a' && ch <= 'z')
|| (ch >= 'A' && ch <= 'Z')
|| (ch == '@')
|| ch == '$'
|| ch == '_'
}

fn is_identifier_part(&self, ch: char) -> bool {
(ch >= 'a' && ch <= 'z')
|| (ch >= 'A' && ch <= 'Z')
|| (ch >= '0' && ch <= '9')
|| (ch == '@')
|| ch == '$'
|| ch == '_'
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the LIMIT parsing path for the shown query and inspect how $2 is classified under the supplied AckoPostgresSqlDialect. Add support for a prepared parameter in LIMIT, then verify that the example query parses successfully with binds [123, 5].

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.