apache / apache/datafusion-sqlparser-rs
Can't evaluate `CREATE TABLE` with `INDEX` in MySQL
- Dominant language
- Rust
- Stars
- 3.5k
- Forks
- 772
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 17
Description
`sqlparser-rs` couldn't evaluate following MySQL statement.
```mysql
CREATE TABLE users (id INT, name VARCHAR(10), INDEX (id));
```
Evaluating this statement by using cli caused following error.
```
[nannany@nannanynoMBP sqlparser-rs (main %=)]$ cargo run --example cli create_table.sql --mysql
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Running `target/debug/examples/cli create_table.sql --mysql`
Parsing from file 'create_table.sql' using MySqlDialect
2022-04-17T07:36:14.347Z DEBUG [sqlparser::parser] Parsing sql 'CREATE TABLE users (id INT, name VARCHAR(10), INDEX (id));
'...
Error during parsing: ParserError("Expected a data type name, found: (")
```
I tried version 0.16.0.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the statement with the CLI example using MySqlDialect and the supplied create_table.sql input. Trace the parser error for the table-level INDEX clause, then add coverage for this MySQL statement and verify that it parses successfully without regressing other CREATE TABLE forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, rust
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100