apache / apache/datafusion-sqlparser-rs

`is_alphabetic` or `is_ascii_alphabetic`?

Offen
#1,418 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
3.5k
Forks
772
Ø Merge
4 T. 9 Std.
Gemergte PRs (30 T.)
17

Beschreibung

https://github.com/sqlparser-rs/sqlparser-rs/blob/4875dadbf5e691dd1e8ef179145829d8ca3ef4d8/src/dialect/mysql.rs#L32

In here, `is_alphabetic` checks for **Unicode Char with Alphabetic property**, which overlaps BMP(Basic Multilingual Plane) but not exclusive to BMP but also to astral plane and Han etc, should those be `is_ascii_alphabetic`?

other use of `is_alphabetic` have similiar problem, i.e. psql support a-z, but also letters with diacritical marks and non-Latin letters, which is kind of ambiguous though(presumably psql mean `is_alphabetic`?

so the current impl of mysql parser will accept chat not in BMP but is still Alphabetic(which is better than mysql standard I guess? but is inconsistent with mysql standard, since there are char in BMP that is not Alphabetic like `,`(FULLWIDTH COMMA)and Alphabetic Char not in BMP

refs to standards:
- unicode standard: https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt see `# Derived Property: Alphabetic` section
- mysql standard: https://dev.mysql.com/doc/refman/8.0/en/identifiers.html see
```
- Permitted characters in unquoted identifiers:

- ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore)

- Extended: U+0080 .. U+FFFF
```
- psql standard: https://www.postgresql.org/docs/current/sql-syntax-lexical.html see `SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_)`

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with src/dialect/mysql.rs at line 32 and audit the other uses of `is_alphabetic` mentioned in the issue. Compare each dialect's identifier rules with the cited MySQL, PostgreSQL, and Unicode standards, then clarify the intended behavior and add regression coverage for the agreed character ranges.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust, sql
Bereich
compilers, databases
Issue-Typ
Bug
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.