Bug #5403 fields named "references" improperly dumped by mysqldump
Submitted: 4 Sep 2004 1:14 Modified: 4 Sep 2004 10:12
Reporter: Eric Towers Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S2 (Serious)
Version:3.23.58 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[4 Sep 2004 1:14] Eric Towers
Description:
Observed once; no replication attempted.

A table containing several fields, one of which was named "references" was exported to file by mysqldump.  The exported file did not place the field name in quotation marks.  When the dump file was used to reload the table, a syntax error was detected near the field name "references".

Observed behaviour: mysqldump()s of well-formed tables are not successfully reloaded.

Expected behaviour: mysqldump()s of well-formed tables are always successfully reloaded.

Additional observations:  MySQLCC reports that the create table command should be of the form
<quotation>
  `chemical_decomp` text,
  `references` text,
  `classification` enum('foo','bar','baz') default 'foo',
</quotation>
whereas the create table command created by mysqldump is of the form
<quotation>
   chemical_decomp text, 
   references text, 
   classification enum('foo','bar','baz') default 'foo',
</quotation>

Assumption: The field name "references" was being parsed as the keyword "references" because the field name was not set off in quotes.

How to repeat:
Create a table with a references field.
Export with mysqldump
Try to reload the dump-file.

Suggested fix:
mysqldump should emit "create table" commands with fields in quotation marks.
[4 Sep 2004 10:12] MySQL Verification Team
Hi,

Thank you for the report, but this is not a bug. You should use --quote-names option of mysqldump. From version 4.1.1 this option is enabled by default.