sqlparser 0.62.0
CREATE TABLE table (a INT); works will.
fn main() -> anyhow::Result<()> {
let s = "CREATE TABLE table (a INT);";
let statements = sqlparser::parser::Parser::parse_sql(&sqlparser::dialect::GenericDialect::default(), s)?;
println!("{statements:?}");
Ok(())
}
But CREATE TABLE table (key INT); fails to parse.
fn main() -> anyhow::Result<()> {
let s = "CREATE TABLE table (key INT);";
let statements = sqlparser::parser::Parser::parse_sql(&sqlparser::dialect::GenericDialect::default(), s)?;
println!("{statements:?}");
Ok(())
}
Error: sql parser error: Expected: a list of columns in parentheses, found: ) at Line: 1, Column: 28
If use SqliteDialect, it can run normally.
fn main() -> anyhow::Result<()> {
let s = "CREATE TABLE table (key INT);";
let statements = sqlparser::parser::Parser::parse_sql(&sqlparser::dialect::SQLiteDialect::default(), s)?;
println!("{statements:?}");
Ok(())
}
sqlparser 0.62.0
CREATE TABLE table (a INT);works will.But
CREATE TABLE table (key INT);fails to parse.If use
SqliteDialect, it can run normally.