xuxiaocheng0201 opened a new issue, #2342:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2342
sqlparser 0.62.0
`CREATE TABLE table (a INT);` works will.
```rust
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.
```rust
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(())
}
```
```text
Error: sql parser error: Expected: a list of columns in parentheses, found:
) at Line: 1, Column: 28
```
If use `SqliteDialect`, it can run normally.
```rust
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(())
}
```
--
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]