You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect parsing literals that consisting of digits and letters, beginning with digits #804
Althrough nodody would name their columns like 1col00column, mysql does allow this.
CREATE DATABASE test;
use test;
CREATE TABLE my_table (
id int,
1col int,
2col int
);
INSERT INTO my_table VALUES (1,2,3);
INSERT INTO my_table VALUES (2,3,4);
INSERT INTO my_table VALUES (3,4,5);
SELECT * FROM my_table;
SELECT 1col FROM my_table
Okay, I think it has nothing to do with if some dialect supports column name beginning with numbers. This is simply a bug about parsing word tokens incorrectly
Activity
DiamondMofeng commentedon Feb 3, 2023
Althrough nodody would name their columns like
1col00column, mysql does allow this.DiamondMofeng commentedon Feb 3, 2023
As you can see,
SELECT 1col FROM mytablewas treated asSELECT 1 col FROM mytableDiamondMofeng commentedon Feb 6, 2023
Okay, I think it has nothing to do with if some dialect supports column name beginning with numbers. This is simply a bug about parsing word tokens incorrectly

Jefffrey commentedon Feb 6, 2023
I believe this is intended behaviour, at least for Generic/Postgres dialect. Relevant bit of discussion here:
#768 (comment)
Though some dialects can support having their identifiers begin with a number, such as Hive:
https://github.com/sqlparser-rs/sqlparser-rs/blob/4955863bdf0e9d90e0fff72bca7912b3d20daac2/src/dialect/hive.rs#L23-L28
Though this does cause some issues with parsing numbers, for example exponent parsing does not work (related to above discussion)
Since Hive supports it, same could be enabled for MySql now which has an existing comment about it:
https://github.com/sqlparser-rs/sqlparser-rs/blob/4955863bdf0e9d90e0fff72bca7912b3d20daac2/src/dialect/mysql.rs#L19-L29
AviRaboah commentedon Apr 20, 2023
Any update about this issue? do this issue should be fixed in the near future for mysql?
thanks.