dolthub / go-mysql-server

A MySQL-compatible relational database with a storage agnostic query engine. Implemented in pure Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow table names with special characters when MySql allows them

nicktobey opened this issue · comments

We appear to be too strict with table names.

According to the MySql documentation (https://dev.mysql.com/doc/refman/8.0/en/identifiers.html):

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 

Permitted characters in quoted identifiers include the full Unicode Basic Multilingual Plane (BMP), except U+0000:

ASCII: U+0001 .. U+007F

Extended: U+0080 .. U+FFFF 

However, when I attempt to create a table with ? (U+003F) in its name, I get an error even though the identifier is quoted:

error on line 1 for query CREATE TABLE `table?` (pk int): Invalid table name table?. Table names must match the regular expression ^[a-zA-Z]{1}$|^[a-zA-Z_]+[-_0-9a-zA-Z]*[0-9a-zA-Z]+$