Bug #2989 mysqldump does not quote reserved words used as field names
| Submitted: | 26 Feb 2004 23:36 | Modified: | 26 Feb 2004 23:47 |
|---|---|---|---|
| Reporter: | Carsten Pedersen | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: mysqldump Command-line Client | Severity: | S2 (Serious) |
| Version: | 4.0.17 | OS: | Any (Any) |
| Assigned to: | CPU Architecture: | Any |
[26 Feb 2004 23:47]
Carsten Pedersen
Apparently, an old version of mysqldump was used during the dump
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Field names are not quoted during dump. This creates problems on re-import of the data when reserved words have been used as identifiers How to repeat: mysql> show create table categories\G *************************** 1. row *************************** Table: categories Create Table: CREATE TABLE `categories` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `default` enum('y','n') default 'n', `cat_owner` int(10) unsigned default NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM 1 row in set (0.00 sec) gets dumped as: -- -- Table structure for table `categories` -- CREATE TABLE categories ( id int(10) unsigned NOT NULL auto_increment, name varchar(255) NOT NULL default '', default enum('y','n') default 'n', cat_owner int(10) unsigned default NULL, PRIMARY KEY (id) ) TYPE=MyISAM; - note how the "default" column is unquoted, this breaks re-import Suggested fix: quote all field names in mysqldump. Workaround is to rename the field to a non-reserved word or edit the dump file manually to insert quotes.