apache / apache/datafusion-sqlparser-rs

Unquoted identifiers naming rule is incorrect

Open
#1,197 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the MySQL test near tests/sqlparser_mysql.rs:1661, then read the unquoted-identifier logic in src/tokenizer.rs:803-811 and the MYSQL and HIVE dialect definitions. Update the rule coverage for both dialects and add or adjust tests so @ is rejected and the documented ASCII and extended ranges are accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, rust, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.