Bug #1148 mysqldump get error with table name equal reserved keywords
Submitted: 27 Aug 2003 4:43 Modified: 2 Sep 2003 9:26
Reporter: Vasily Shabanov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:3.23.55 OS:Linux (Linux (All OS))
Assigned to: Sergei Golubchik CPU Architecture:Any

[27 Aug 2003 4:43] Vasily Shabanov
Description:
If table has name equal reserved words (like a "check") mysqldump get error «/usr/local/mysql/bin/mysqldump: Can't get info about table: 'check'
error: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'check' at line 1» and finished.

How to repeat:
always

Suggested fix:
In mysqldump change line     
689: sprintf(insert_pat,"show fields from %s",table_name);
to
689: sprintf(insert_pat,"show fields from `%s`",table_name);
[27 Aug 2003 4:50] Vasily Shabanov
Change lines 681, 701, 704, 729, 759, 763, 766, 788, 811
[27 Aug 2003 5:15] Sergei Golubchik
your simple fix won't work, because for --quote-names table_name will contain quotes already, the fix is a little bit more complex (but, yes, just a little bit)
[2 Sep 2003 9:26] Sergei Golubchik
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

fixed in 3.23.59 and 4.0.16
[20 Nov 2003 10:16] Steve Mershon
There is a related problem that appears not to have been fixed in the 4.0.16 release of mysqldump.  My database has some field names that are two words with a space in between.  mysqldump produces lines such as the following, which cause syntax errors when I attempt to load the data, because there are no backquotes around the two-word field name 'Last Updated`:

CREATE TABLE Company (
  ...
  Last Updated timestamp(14) NOT NULL,
  ...
) TYPE=MyISAM;