mjbshaw opened a new pull request, #2273: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2273
PostgreSQL 14 added [LOCK](https://www.postgresql.org/docs/current/sql-lock.html). This implements parsing support for that statement. Beyond the added tests, the following minimum reproducible example demonstrate's sqlparser's current failure to parse this statement: **Cargo.toml:** ``` [package] name = "demo" version = "0.1.0" edition = "2024" [workspace] [dependencies] sqlparser_patched = { package = "sqlparser", path = "path/to/mjbshaw/fork/datafusion-sqlparser-rs" } sqlparser_published = { package = "sqlparser", version = "0.61.0" } ``` **src/main.rs:** ``` use sqlparser_patched::dialect::PostgreSqlDialect as PatchedPostgreSqlDialect; use sqlparser_patched::parser::Parser as PatchedParser; use sqlparser_published::dialect::PostgreSqlDialect as PublishedPostgreSqlDialect; use sqlparser_published::parser::Parser as PublishedParser; const SQL: &str = "LOCK TABLE public.widgets IN EXCLUSIVE MODE"; fn main() { match PublishedParser::parse_sql(&PublishedPostgreSqlDialect {}, SQL) { Ok(statements) => panic!( "expected published sqlparser 0.61.0 to reject `{SQL}`, but it parsed: {statements:?}" ), Err(error) => { println!("published sqlparser 0.61.0 failed as expected: {error}"); } } let statements = PatchedParser::parse_sql(&PatchedPostgreSqlDialect {}, SQL) .expect("patched sqlparser should parse PostgreSQL LOCK TABLE"); assert_eq!(statements.len(), 1, "expected exactly one statement"); println!("patched sqlparser parsed successfully: {}", statements[0]); } ``` Then run with `cargo run`. -- 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]
