Bug #1111 mysqldump with field named order
Submitted: 21 Aug 2003 6:44 Modified: 21 Aug 2003 9:45
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:3.23.49a-Max OS:Linux (Redhat 7.3)
Assigned to: CPU Architecture:Any

[21 Aug 2003 6:44] [ name withheld ]
Description:
I have a table with aư field called 'order'. When doing a mysqldump on that folder the create table syntax is incorrect.
CREATE TABLE user_group (
  id int(10) unsigned NOT NULL auto_increment,
  title varchar(64) NOT NULL default '',
  order int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (id),
  UNIQUE KEY order (order)
) TYPE=MyISAM;

order has to be in quotes so you can use this statement

How to repeat:
Create the table, mysqldump it, create it using the syntax that comes from mysqldump

Suggested fix:
Have quotes around every fieldname (or at least the one that are part of the language)
[21 Aug 2003 9:45] Indrek Siitan
ORDER is a reserved word in MySQL and using reserved words as identifiers
is generally a bad idea. To not promote the bad idea, quoting identifiers in
mysqldump is off by default (one shouldn't need that for other reasons).

If you need quoting, run mysqldump with -Q option, or put the following
lines into your /etc/my.cnf to enable this behaviour by default:

  [mysqldump]
  quote-names