apache / apache/datafusion-sqlparser-rs
MySQL Compatibility Issues
- Lenguaje dominante
- Rust
- Estrellas
- 3.5k
- Forks
- 772
- Merge medio
- 4 d 9 h
- PR fusionados (30 d)
- 17
Descripción
Hi - first want to say what an amazing and fun to work with lib this is!
Looking to use this for a MySQL project, but some of the queries I'm working with aren't supported yet.
It seems for now you are accepting dialect-specific extensions in the mainline parser, so am happy to work on this. I have a fork which fixes each of the following issues. Should I open separate issues/PRs, or is it more helpful if I raise a PR for all them? (Several are just `bool`s on `Statement::{ }` variants)
##### `INSERT [IGNORE] ...` ([mysqltutorial](https://www.mysqltutorial.org/mysql-insert-ignore/))
__Summary:__ An optional `IGNORE` keyword after `INSERT`
__Query:__ `INSERT IGNORE INTO user (id) VALUES (1)`
__Result:__ `ParserError("Expected one of INTO or OVERWRITE, found: IGNORE")`
---
##### `INSERT [INTO] tbl_name ...` ([docs](https://dev.mysql.com/doc/refman/5.6/en/insert.html))
__Summary:__ The `INTO` keywords is optional
__Query:__ `INSERT user (id) VALUES (1)`
__Result:__ `ParserError("Expected one of INTO or OVERWRITE, found: users")`
---
##### `INSERT ... SET ` ([docs](https://dev.mysql.com/doc/refman/5.6/en/insert.html), [SO](https://stackoverflow.com/questions/861722/mysql-insert-into-table-values-vs-insert-into-table-set))
__Summary:__ Inserts can set fields with an alternate syntax, similar to an `UPDATE` query
__Query:__ `INSERT INTO user SET id = 1`
__Result:__ `ParserError("Expected SELECT, VALUES, or a subquery in the query body, found: SET")`
---
##### `INSERT ... [ON DUPLICATE KEY UPDATE ]` ([mysqltutorial](https://www.mysqltutorial.org/mysql-insert-or-update-on-duplicate-key-update/))
__Summary:__ Inserts can fallback to updates on a key collision
__Query:__ `INSERT INTO user (id, name) VALUES (1, 'Printer') ON DUPLICATE KEY UPDATE name = 'Central Printer'`
__Result:__ `ParserError("Expected end of statement, found: ON")`
---
##### `UPDATE ... [ORDER BY ...] [LIMIT row_count]` ([docs](https://dev.mysql.com/doc/refman/8.0/en/update.html))
__Summary:__ Updates can optionally include `ORDER BY` and `LIMIT` clauses
__Query:__ `UPDATE user SET id = 1 ORDER BY id LIMIT 1`
__Result:__ `ParserError("Expected end of statement, found: ORDER")`
---
##### `DELETE ... [ORDER BY ...] [LIMIT row_count]` ([docs](https://dev.mysql.com/doc/refman/5.6/en/delete.html))
__Summary:__ Deletes can optionally include `ORDER BY` and `LIMIT` clauses
__Query:__ `DELETE FROM user ORDER BY id LIMIT 1`
__Result:__ `ParserError("Expected end of statement, found: ORDER")`
---
##### `BINARY ` ([docs](https://dev.mysql.com/doc/refman/5.6/en/cast-functions.html#operator_binary))
__Summary:__ The `BINARY` operator/unary function can operate without parameters (similar to `INTERVAL 1 DAYS`)
__Query:__ `SELECT * FROM user WHERE name = BINARY 'name'`
__Result:__ `ParserError("Expected end of statement, found: \'name\'")`
---
Many thanks!
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza con el parser de mainline y las variantes de Statement mencionadas en el issue, y luego reproduce cada una de las siete consultas MySQL para identificar sus fallos actuales de parseo. Se considera terminado cuando todas las formas INSERT, UPDATE, DELETE y BINARY enumeradas se acepten sin errores del parser y se haya añadido cobertura para cada variante sintáctica.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- mysql, rust, sql
- Área
- databases
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100