apache / apache/datafusion-sqlparser-rs
MySQL Compatibility Issues
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 17
描述
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!
贡献指南
这个仓库没有索引到贡献指南
调研方向
从主线解析器和 issue 中提到的 Statement 变体开始,然后分别复现七条 MySQL 查询,以确定它们当前的解析失败情况。完成的标准是:列出的所有 INSERT、UPDATE、DELETE 和 BINARY 形式都能在没有解析器错误的情况下被接受,并且已为每种语法变体添加覆盖测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- mysql, rust, sql
- 领域
- databases
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100