You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PostgreSqlDialect rejects FETCH statements with omitted direction, FROM/IN, or signed counts #3050
use sqlparser::{dialect::PostgreSqlDialect, parser::Parser};fnmain(){for sql in["FETCH c;","FETCH 1 c;","FETCH FORWARD FROM c;","FETCH -1 FROM c;",]{matchParser::parse_sql(&PostgreSqlDialect{}, sql){Ok(statements) => println!("{sql} => {statements:?}"),Err(error) => println!("{sql} => {error}"),}}}
Actual behavior
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).
Activity