apache / apache/datafusion-sqlparser-rs
MySQL Compatibility Issues: mysqldump
- Ngôn ngữ chính
- Rust
- Star
- 3.5k
- Fork
- 772
- Merge trung bình
- 4 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 17
Mô tả
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`
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện các lỗi của parser với SQL mysqldump được hiển thị trong issue, bao gồm ENGINE, LOCK TABLES, các dấu nháy đơn đã được escape và UNLOCK. So sánh từng cấu trúc với cú pháp MySQL hoặc MariaDB được parser hỗ trợ; hoàn tất khi các câu lệnh dump được liệt kê được parse thành công mà không có hồi quy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- mariadb, mysql, rust
- Lĩnh vực
- databases
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100