icecrasher321 opened a new issue, #3050:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/3050
### Reproduction
With `sqlparser = "=0.64.0"`:
```rust
use sqlparser::{dialect::PostgreSqlDialect, parser::Parser};
fn main() {
for sql in [
"FETCH c;",
"FETCH 1 c;",
"FETCH FORWARD FROM c;",
"FETCH -1 FROM c;",
] {
match Parser::parse_sql(&PostgreSqlDialect {}, sql) {
Ok(statements) => println!("{sql} => {statements:?}"),
Err(error) => println!("{sql} => {error}"),
}
}
}
```
### Actual behavior
```text
FETCH c; => sql parser error: Expected: a concrete value, found: c at Line:
1, Column: 7
FETCH 1 c; => sql parser error: Expected FROM or IN at Line: 1, Column: 9
FETCH FORWARD FROM c; => sql parser error: Expected: a concrete value,
found: FROM at Line: 1, Column: 15
FETCH -1 FROM c; => sql parser error: Expected: a value, found: - at Line:
1, Column: 7
```
### Expected behavior
All four statements parse as `Statement::Fetch` (treating an omitted
direction as `NEXT`, allowing `FROM`/`IN` and `FORWARD`/`BACKWARD` counts to be
omitted, and accepting signed counts).
[PostgreSQL documentation for
FETCH](https://www.postgresql.org/docs/current/sql-fetch.html)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]