Bug #2283 MySQL CREATE TABLE command does not quote names with spaces.
Submitted: 5 Jan 2004 7:17 Modified: 5 Jan 2004 11:02
Reporter: Lee Leahu Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:4.0.16 OS:Linux (gentoo linux)
Assigned to: CPU Architecture:Any

[5 Jan 2004 7:17] Lee Leahu
Description:
MySQL CREATE TABLE syntax does not quote names with spaces. 
 
-- MySQL dump 9.09 
-- 
-- Host: localhost    Database: db1 
-- ------------------------------------------------------ 
-- Server version       4.0.16 
 
-- 
-- Table structure for table `CSA Survey Cat ATS PM` 
-- 
 
DROP TABLE IF EXISTS `CSA Survey Cat ATS PM`; 
CREATE TABLE CSA Survey Cat ATS PM ( 
  CU_NAME varchar(30) default NULL, 
  ATS_MFGR varchar(15) default NULL, 
  SWITCH_TYPE varchar(16) default NULL, 
  ATS_SERNUM varchar(20) NOT NULL default '', 
  KEY ATS_SERNUM (ATS_SERNUM) 
) TYPE=MyISAM; 
 
 

How to repeat:
mysqldump --opt -u <username -p<password> <dbname> > <dbfile> 
 
 

Suggested fix:
Quote the table names properly.
[5 Jan 2004 7:35] MySQL Verification Team
Please us proper option for this:

 ./client/mysqldump --quote-names bug
-- MySQL dump 9.10
--
-- Host: localhost    Database: bug
-- ------------------------------------------------------
-- Server version       4.0.18-debug

--
-- Table structure for table `t1-t2`
--

CREATE TABLE `t1-t2` (
  `c1-cw` int(11) default NULL,
  `a b` int(11) default NULL,
  `id` int(11) default NULL
) TYPE=MyISAM;

--
-- Dumping data for table `t1-t2`
--
[5 Jan 2004 7:44] Lee Leahu
That isnt right! 
 
If the delete table syntax is going to be always quoted, then the create table syntax 
should be as well!
[5 Jan 2004 11:02] Sergei Golubchik
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in MySQL.

Additional info:

you're right that it's a bug. Still, it's a duplicate.

duplicate of #2280