Bug #5294 mysqldump does not quote identifiers properly
Submitted: 30 Aug 2004 18:44 Modified: 30 Aug 2004 19:23
Reporter: Timothy Smith Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:3.23, 4.0 OS:Any (any)
Assigned to: CPU Architecture:Any

[30 Aug 2004 18:44] Timothy Smith
Description:
mysqldump in versions < 4.1 doesn't quote identifiers.   mysqldump in version 4.1 seems to use the correct output from SHOW CREATE TABLE.

How to repeat:
mysql> create table t (`a/b` int);
Query OK, 0 rows affected (0.02 sec)

mysql> show create table t;
+-------+---------------------------------------------------------------+
| Table | Create Table                                                  |
+-------+---------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a/b` int(11) default NULL
) TYPE=MyISAM |
+-------+---------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> Bye
tim@sand:~$ mysqldump test t
-- MySQL dump 9.10
--
-- Host: localhost    Database: test
-- ------------------------------------------------------
-- Server version       4.0.21-debug

--
-- Table structure for table `t`
--

CREATE TABLE t (
  a/b int(11) default NULL
) TYPE=MyISAM;

--
-- Dumping data for table `t`
--

tim@sand:~$ 

Suggested fix:
backport mysqldump from 4.1 into 4.0
[30 Aug 2004 19:23] Timothy Smith
First, I just didn't know about mysqldump --quote-names, which takes care of the immediate problem.

Second, MySQL 4.1, even without --quote-names (which is on by default, by the way), quotes otherwise  illegal identifiers.  Since this is a server-side change, it is not in earlier versions of MySQL.