Bug #2591 mysqldump quotes names inconsistently
Submitted: 30 Jan 2004 18:19 Modified: 11 Mar 2004 7:23
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Victor Vagin CPU Architecture:Any

[30 Jan 2004 18:19] Paul DuBois
Description:
If you put the server into ANSI_QUOTES mode,
SHOW CREATE TABLE quotes names using double
quote (") rather than backticks (`). However,
mysqldump does not follow this consistently.
Identifiers will be quoted in the output with
double quote for CREATE TABLE, but not for
DROP TABLE.  For example:

DROP TABLE IF EXISTS `columns_priv`;
CREATE TABLE "columns_priv" (
  "Host" char(60) binary NOT NULL default '',
  "Db" char(64) binary NOT NULL default '',
  "User" char(16) binary NOT NULL default '',
  "Table_name" char(64) binary NOT NULL default '',
  "Column_name" char(64) binary NOT NULL default '',
  "Timestamp" timestamp NOT NULL,
  "Column_priv" set('Select','Insert','Update','References') NOT NULL default ''
,
  PRIMARY KEY  ("Host","Db","User","Table_name","Column_name")
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Column privileges';

How to repeat:
Issue:

SET GLOBAL sql_mode='ANSI_QUOTES';

(or start server with --sql-mode=ANSI_QUOTES)

Then run mysqldump.

Note: in MySQL 4.0, SHOW CREATE TABLE doesn't respect ANSI_QUOTES,
so mysqldump doesn't use double quotes at all when ANSI_QUOTES
is on.

Suggested fix:
I suppose quote_name() in mysqldump.c needs
to know whether or not ANSI_QUOTES is on.
[8 Feb 2004 6:24] Victor Vagin
bk commit - 4.1 tree (vva:1.1688)

ChangeSet
  1.1688 04/02/08 22:12:21 vva@eagle.mysql.r18.ru +3 -0
  1. fixed bug #2591 "mysqldump quotes names inconsistently"
  2. fixed option --compatible to add modes to output
  3. fixed option --comments=0 to output setting of modes in header
[11 Mar 2004 3:05] Victor Vagin
latest patch is:

bk commit - 4.1 tree (vva:1.1715)

ChangeSet
  1.1715 04/03/11 18:46:27 vva@eagle.mysql.r18.ru +3 -0
  fixed bug #2591 "mysqldump quotas names inconsistently"
[11 Mar 2004 7:23] Victor Vagin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Fix will be in mysql-4.1.2