apache / apache/datafusion-sqlparser-rs

Unquoted identifiers naming rule is incorrect

未关闭
#1,197 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
3.5k
派生
772
平均合并
4 天 9 小时
30 天内合并 PR
17

描述

The naming rule is in https://dev.mysql.com/doc/refman/8.0/en/identifiers.html

The rule for unquoted identifiers is incorrect.
* ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore)
* Extended: U+0080 .. U+FFFF

In the following test, we can see that `@` is unpermitted
https://github.com/sqlparser-rs/sqlparser-rs/blob/44727891713114b72546facf21a335606380845a/tests/sqlparser_mysql.rs#L1661

I think we need to fix the unquoted identifiers for MYSQL and HIVE
https://github.com/sqlparser-rs/sqlparser-rs/blob/44727891713114b72546facf21a335606380845a/src/tokenizer.rs#L803-L811

MYSQL
https://github.com/sqlparser-rs/sqlparser-rs/blob/44727891713114b72546facf21a335606380845a/src/dialect/mysql.rs#L28-L41

HIVE
https://github.com/sqlparser-rs/sqlparser-rs/blob/44727891713114b72546facf21a335606380845a/src/dialect/hive.rs#L28-L36

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 tests/sqlparser_mysql.rs:1661 附近的 MySQL 测试开始,然后阅读 src/tokenizer.rs:803-811 中未加引号标识符的逻辑以及 MYSQL 和 HIVE 方言定义。更新两个方言的规则覆盖范围,并添加或调整测试,使 @ 被拒绝,同时接受文档中说明的 ASCII 和扩展范围。

由索引模型根据 Issue 内容生成。

评估

技术栈
mysql, rust, sql
领域
databases
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。