Bug #3830 mysqldump and "key ... (user(...))"
Submitted: 19 May 2004 15:12 Modified: 19 May 2004 18:34
Reporter: Slaven Rezic 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:pc-linux (i686)
Assigned to: Dean Ellis CPU Architecture:Any

[19 May 2004 15:12] Slaven Rezic
Description:
If a table contains the key definition

   key something (user(length))

then mysqldump creates SQL which cannot be used to re-create the table.

How to repeat:
Rougly (mysql> from the mysql client, $ from the shell):

mysql> create table test (user varchar(255), key user_key (user (3)));

$ mysqldump ... database > /tmp/dump

mysql> drop table test;

$ mysql ... database < /tmp/dump
Enter password: 
ERROR 1064 at line 11: You have an error in your SQL syntax near 'user(3))
) TYPE=MyISAM' at line 3
Exit 1

Suggested fix:
Add a space between the fieldname and index length in the mysqldump dump, at least for functions.
[19 May 2004 18:34] Dean Ellis
Use the -Q option so that identifiers are properly escaped.