Bug #4717 ALTER TABLE ... RENAME permits \ in new name but not old name.
Submitted: 23 Jul 2004 8:30 Modified: 26 Jul 2004 10:42
Reporter: Nick Gaugler Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.20 OS:Linux (Linux)
Assigned to: Sergei Golubchik CPU Architecture:Any

[23 Jul 2004 8:30] Nick Gaugler
MySQL permits you to rename a current table to a new name that contains a \ but does not give you anyway to rename it back. 

How to repeat:
mysql> create table testme (id int);
Query OK, 0 rows affected (0.01 sec)

mysql> alter table testme rename to `testme\\`;
Query OK, 0 rows affected (0.04 sec)

mysql> alter table `testme\\` rename to `testme`;
ERROR 1103: Incorrect table name 'testme\\'

Suggested fix:
MySQL should not permit you rename to a name that contains a \.  The same code that checks the table name for current tables should check the new name.
[26 Jul 2004 0:43] MySQL Verification Team
According as stated in the Manual: 10.2 Database, Table, Index, Column, and Alias Names


Identifier  Maximum Length (bytes) 	 Allowed Characters

Table 	    64 	                                   Any character that is allowed in a filename, except `/', `\', or `.'

then you can expect unexpected behavior.
[26 Jul 2004 10:20] Sergei Golubchik
Indeed, ALTER TABLE ... RENAME does not check whether the destination name is well-formed
(but RENAME TABLE ... does)
[26 Jul 2004 10:42] 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

Additional info:

fixed in 4.0.21