apache / apache/datafusion-sqlparser-rs
MySQL Compatibility Issues: mysqldump
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 17
描述
I ran into multiple MySQL compatibility issues when attempting to parse a dump produced by `sudo mysqldump dbname > dbname_backup.sql` (also see [mysqldump docs](https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html) or [mariadb docs](https://mariadb.com/kb/en/mysqldump/)).
Here is an example of `mysqldump` generated SQL (this database is from a [WordPress](https://wordpress.com/) installation):
```
-- MySQL dump 10.16 Distrib 10.1.26-MariaDB, for debian-linux-gnu (x86_64)
--
-- Table structure for table `wp_users`
--
DROP TABLE IF EXISTS `wp_users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `wp_users` (
`ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_login` varchar(60) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`user_pass` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`user_nicename` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`user_email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`user_url` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`user_activation_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`user_status` int(11) NOT NULL DEFAULT '0',
`display_name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`ID`),
KEY `user_login_key` (`user_login`),
KEY `user_nicename` (`user_nicename`),
KEY `user_email` (`user_email`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `wp_users`
--
LOCK TABLES `wp_users` WRITE;
/*!40000 ALTER TABLE `wp_users` DISABLE KEYS */;
INSERT INTO `wp_users` VALUES (1,'MyUser','PasswordHash','myuser','myuser@example.com','','2020-09-22 14:45:28','',0,'My\'User');
/*!40000 ALTER TABLE `wp_users` ENABLE KEYS */;
UNLOCK TABLES;
```
More specifically (deleting various bits to expose more errors):
- https://github.com/ballista-compute/sqlparser-rs/issues/279
- `sql parser error: Expected end of statement, found: ENGINE`
- `sql parser error: Expected an SQL statement, found: LOCK`
- `sql parser error: Expected ), found: User`
(see `'My\'User'` in the example - it seems like the escaping on the `'` immediately before `User` was not handled)
- `sql parser error: Expected an SQL statement, found: UNLOCK`
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先,使用 issue 中展示的 mysqldump SQL 重现 parser 错误,包括 ENGINE、LOCK TABLES、转义的撇号和 UNLOCK。将每个构造与 parser 支持的 MySQL 或 MariaDB 语法进行比较;完成标准是列出的 dump 语句都能成功解析且没有回归。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- mariadb, mysql, rust
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100