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
use sqlparser::{
dialect::GenericDialect,
parser::{Parser,ParserError,ParserOptions},};fnmain() -> Result<(),ParserError>{let dialect = GenericDialect{};let options = ParserOptions::new().with_trailing_commas(true);let result = Parser::new(&dialect).with_options(options).try_with_sql("GRANT USAGE, SELECT ON SEQUENCE p TO u")?
.parse_statements();println!("{:?}", result);Ok(())}
Output
Err(ParserError("Expected ON, found: SELECT at Line: 1, Column 14"))
parse_comma_separated guesses that the comma is a trailing comma since it's followed by a reserved keyword (SELECT).
The text was updated successfully, but these errors were encountered:
MohamedAbdeen21
changed the title
Error on GRANT statements when trailing commas enabled
Error on some GRANTs when trailing commas are enabled
Apr 11, 2024
How to reproduce
Output
Expected Output
Should parse successfully.
Cause
parse_comma_separated
guesses that the comma is a trailing comma since it's followed by a reserved keyword (SELECT).The text was updated successfully, but these errors were encountered: