Bug #37706 mysqlcheck fails during upgrade of tables whose names include backticks
Submitted: 28 Jun 2008 2:53 Modified: 28 Jun 2008 2:54
Reporter: Omer Barnir (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.26 OS:Any
Assigned to: CPU Architecture:Any

[28 Jun 2008 2:53] Omer Barnir
Description:
This bug a partial re-occurrence of bag#30654. It seems the problem of mysqlcheck failing during upgrade was fixed only for the case where the names include spaces but not for the case where the names include backticks such as in:
- ta1`b - created by:  create table `ta1``b`

How to repeat:
1) Create a 5.0 system and add a table named "ta1`b" using:
   CREATE TABLE `ta1``b` (I INT);
2) Upgrade the system to 5.1 
3) Run the mysql_upgrade command:
      mysql_upgrade --datadir=<path_to_data> --basedir=<path to binaries> --force
                    --socket=>socket_file> --user=root

Workarownd
----------
Before running mysql_upgrade, rename all tables that required a delimiter when defined, to
names that do not require it, for example:
  RENAME TABLE `ta1``b` TO ta1_b;

Run the mysql_upgrade program

Rename the tables back to their original names:
  RENAME TABLE ta1_b TO `ta1``b`;

Suggested fix:
If encountering a backtick in the name - duplicate it