Bug #44594 RENAME TABLE may empty the table definition
Submitted: 1 May 2009 5:29 Modified: 3 Jun 2009 16:52
Reporter: Fred Barboteu Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: DDL Severity:S1 (Critical)
Version:5.0.27-community-log OS:Windows (XP)
Assigned to: CPU Architecture:Any
Tags: rename table, Special Characters, table definition lost

[1 May 2009 5:29] Fred Barboteu
Description:
DETAILED SOFTWARE VERSIONS:
. MySQL server: 5.0.27-community-log
. MySQL client: 5.0.51a
. protocol: 10
. web server: Apache/2.2.3 (Win32) PHP/5.2.6
. PHP extension: mysql

WHAT I DID:
(the following happened using phpMyAdmin, but it doesn't seam possible the bug comes from PMA)
I was trying to identify which special characters MySQL could accept or not as first one in a table name.
After some of them had been successfull (like "#", "&", "!"), I tried with ":".
More precisely, I executed the query:
RENAME TABLE `!_foo` TO `:_foo`.

WHAT I EXPECTED TO HAPPEN:
Depending on the ":" character is accepted or not, either:
. table to be renamed
. or an error message to be displayed, like "#1103 - Incorrect table name `:_foo`"

WHAT ACTUALLY HAPPENED:
1>>> PMA reported success, but its tables list showed an unchanged table name `!_foo`, and any query involving this table fired an error
2>>> Looking at the mysql/data directory, I found that:
. files for this table had keeped their original name "!_foo.frm", "!_foo.MYI" and "!_foo.MYD" (I use MyISAM engine)
. but the .frm and .MYI ones had both been emptied (0 K)!

How to repeat:
Verified:
. create a table `!_foo` with, say, 2 fields `row`(INT) and `data`(CHAR(16))
. execute the query RENAME TABLE `!_foo` TO `:_foo`
[3 May 2009 11:00] Sveta Smirnova
Thank you for the report.

But version 5.0.27 is too old. Additionally I can not repeat described behavior with current development sources. Please try with current version 5.0.77 and inform us if problem still exists. Also try using mysql command line client: there is possibility of escaping problem in PhpMyAdmin
[3 May 2009 15:20] Fred Barboteu
Thanks to have been looking at the problem.

1. You said that "there is possibility of escaping problem in
PhpMyAdmin". So to be sure, and as I'm not familiar with the command line, I created a direct test case in PHP.
With 5.0.27, I confirm that the behaviour is the same as through phpMyAdmin.

2. I cannot see how to get 5.0.77: downloads page only proposes MySQL 5.1!
So here I'm stuck. Thanks to direct me to the right page.
[3 May 2009 16:52] Valeriy Kravchuk
You can get 5.0.77 from http://dev.mysql.com/downloads/mysql/5.0.html. Please, check it.
[3 Jun 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".