Bug #9783 | Unable to create a new database with a name containing a hyphen | ||
---|---|---|---|
Submitted: | 9 Apr 2005 14:58 | Modified: | 9 Apr 2005 15:21 |
Reporter: | David Leangen | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.10 and 4.1.11 | OS: | Linux (Linux RH Fedora 2) |
Assigned to: | CPU Architecture: | Any |
[9 Apr 2005 14:58]
David Leangen
[9 Apr 2005 15:05]
Jim Winstead
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php Additional info: From a little further down on the page: An identifier may be quoted or unquoted. If an identifier is a reserved word or contains special characters, you must quote it whenever you refer to it. For a list of reserved words, see Section 9.6, “Treatment of Reserved Words in MySQL”. Special characters are those outside the set of alphanumeric characters from the current character set, '_', and '$'. You need to quote a name with a hyphen in it, like: create database `some-name`;
[9 Apr 2005 15:09]
David Leangen
Thank you for your VERY fast reply! Actually, I did try quoting it. Here is an example: mysql> create database 'some-name'; 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 ''some-name'' at line 1
[9 Apr 2005 15:21]
Jim Winstead
A value quoted with single-quotes is a string, not an identifier. Identifier quoting is explained at http://dev.mysql.com/doc/mysql/en/legal-names.html, with examples.
[9 Apr 2005 15:24]
David Leangen
Ah, indeed! That works fine. Sorry for wasting bandwidth. Thank you again for your very prompt reply and helpful service!!