Bug #75700 | Cannot create MySQL database with name '5e370227_db' | ||
---|---|---|---|
Submitted: | 30 Jan 2015 12:40 | Modified: | 30 Jan 2015 17:30 |
Reporter: | John Hardy | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
Version: | mysql Ver 14.14 Distrib 5.1.73 | OS: | Linux (Centos 2.6.32-358.el6.x86_64) |
Assigned to: | CPU Architecture: | Any |
[30 Jan 2015 12:40]
John Hardy
[30 Jan 2015 12:48]
Peter Laursen
Also reproducible on MySQL 5.6.22 -- Peter -- not a MySQL/Oracle person
[30 Jan 2015 12:52]
Peter Laursen
This works: CREATE DATABASE `5e370227_db`; So "5e370227" seems to get parsed as a floating point number specifcation(!?). Should it in this context?
[30 Jan 2015 12:57]
John Hardy
mysql> create database '5e370227_db'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''5e370227_db'' at line 1 mysql> create database "5e370227_db"; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"5e370227_db"' at line 1 mysql> create database `5e370227_db`; Query OK, 1 row affected (0.00 sec) So only syntax with backticks works ...
[30 Jan 2015 13:14]
Peter Laursen
Obviously. You quote identifiers with backquotes. Singlequotes and doublequotes are used quoting strings. (in non-ANSI sql_mode) Undoubtedly MySQL thinks that "" is a number. http://dev.mysql.com/doc/refman/5.6/en/identifiers.html says "Identifiers may begin with a digit but unless quoted may not consist solely of digits.". But it does not list this case and the identifier here does no consist solely of numbers (but the server/parser evaluates it to such internally). I would call this a small bug or imperfection with the parser. I don't think the FLOAT evaluation code should trigger here at all.
[30 Jan 2015 13:15]
Peter Laursen
I forgot to paste. I meant: Undoubtedly MySQL thinks that "5e370227_db" is a number.
[30 Jan 2015 14:40]
MySQL Verification Team
Please check with: http://dev.mysql.com/doc/refman/5.1/en/identifiers.html "It is recommended that you do not use names that begin with Me or MeN, where M and N are integers. For example, avoid using 1e as an identifier, because an expression such as 1e+3 is ambiguous. Depending on context, it might be interpreted as the expression 1e + 3 or as the number 1e+3. "
[30 Jan 2015 17:30]
MySQL Verification Team
I will have to agree fully with Peter Laursen. It is a bug in the parser, but a bug that is with low priority. Please, try to avoid identifier names that could be interpreted as IEEE floating point numbers. Hence, it is fully verified.