Bug #997 Mysqldump does not create a correct dump file on some tables
Submitted: 5 Aug 2003 2:34 Modified: 13 Jul 2004 21:36
Reporter: Oleg Ivanov Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:4.1.0-alpha OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[5 Aug 2003 2:34] Oleg Ivanov
Description:
I have a table with a column named 'FROM' wich was created by MySqlControlCenter.
mysql> desc feedback;
+----------+------------------+------+-----+---------+
| Field    | Type             | Null | Key | Default |
+----------+------------------+------+-----+---------+
| ID       | int(10) unsigned |      | PRI | NULL    |
| FROM     | varchar(200)     | YES  |     |         |
+----------+------------------+------+-----+---------+
2 rows in set (0.00 sec)

mysqldump create a dump file with command:
========
CREATE TABLE feedback (
  ID int(10) NOT NULL auto_increment,
  FROM varchar(200) default '',
  PRIMARY KEY  (ID)
) TYPE=MyISAM CHARSET=cp1251;
========
wich CAN NOT RUN in mysql, because 'FROM' is recognized as a keyword.

It is impossible to create this table using
CREATE TABLE ... 'FROM' varchar2 ...;
or 
CREATE TABLE ... "FROM" varchar2 ...;
syntax wich is used in another databases (Oracle) in such cases.

How to repeat:
1) Create table using MySql Control Center with column named 'FROM',
2) dump this table using mysqldump
3) drop table and try to recerate it from a dump.
You will receive an error.

Suggested fix:
allow syntax
CREATE TABLE ... 'FROM' varchar2 ...;
or 
CREATE TABLE ... "FROM" varchar2 ...;
and update mysqldump to use this syntax to create a dumps.
[5 Aug 2003 4:11] Alexander Keremidarski
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem is not the result of a bug.
For a list of more appropriate places to ask for help using MySQL
products, please visit http://www.mysql.com/support/

Thank you for your interest in MySQL.

mysqldump has an option for this
 -Q, --quote-names   Quote table and column names with a `
[13 Jul 2004 16:43] Slaven Rezic
I wonder why the -Q option is not turned on by default? And from a POLA view mysqldump should do everything to make serializing a database quite easy.
[13 Jul 2004 21:36] Sergei Golubchik
It should quote by default. Try a recent version (e.g. 4.1.3)