Bug #72382 mysqlcheck wrongly escapes '.' in table names
Submitted: 18 Apr 2014 15:20 Modified: 18 Apr 2014 21:07
Reporter: Hartmut Holzgraefe Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6.17, all? OS:Linux
Assigned to: CPU Architecture:Any

[18 Apr 2014 15:20] Hartmut Holzgraefe
Description:

mysqlcheck encloses dots in a table in backticks, this doesn't make sense though as never expects to see a db.table combination (database and table names are passed in as separate parameters)

This breaks mysqlcheck, and indirectly mysql_upgrade, for tables with a dot in their name

This was introduced in revision 1810.3494.1 ( http://bazaar.launchpad.net/~mysql/mysql-server/5.6/revision/1810.3494.1 ) as part of a fix for http://bugs.mysql.com/bug.php?id=30654

How to repeat:
test case:

CREATE TABLE test.`foo.bar`(id int primary key);

then run

mysqlcheck test foo.bar

or

mysql_upgrade --force

Suggested fix:
This was introduced in revision 1810.3494.1 ( http://bazaar.launchpad.net/~mysql/mysql-server/5.6/revision/1810.3494.1 ) as part of a fix for http://bugs.mysql.com/bug.php?id=30654

Fix should remove the escaping of '.' and just keep the escaping of '`'
[18 Apr 2014 18:03] MySQL Verification Team
Hello Hartmut,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[18 Apr 2014 18:12] MySQL Verification Team
// 5.6.17 affected

 bin/mysqlcheck test foo.bar
foo.bar
Error    : Table 'foo.bar' doesn't exist
status   : Operation failed

// 5.7.5 doesn't seems to be affected

mysql> select version();
+----------------------------------------------+
| version()                                    |
+----------------------------------------------+
| 5.7.5-m15-enterprise-commercial-advanced-log |
+----------------------------------------------+
1 row in set (0.00 sec)

mysql> CREATE TABLE test.`foo.bar`(id int primary key);
Query OK, 0 rows affected (0.02 sec)

mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| foo.bar        |
+----------------+
1 row in set (0.00 sec)

mysql-5.7.5]# bin/mysqlcheck -uroot -p test foo.bar
Enter password:
test.foo.bar                                       OK

Also, http://bugs.mysql.com/bug.php?id=68015
      http://bugs.mysql.com/bug.php?id=72161

Seems 5.6 is still affected..
[18 Apr 2014 20:20] Hartmut Holzgraefe
something's very weird here on launchpad though:

check 

  http://bazaar.launchpad.net/~mysql/mysql-server/5.6/annotate/head:/client/mysqlcheck.c#L52...

and 

  http://bazaar.launchpad.net/~mysql/mysql-server/5.7/annotate/head:/client/mysqlcheck.c#L52...

the code escaping the '.' is gone in 5.7, but launchpad still lists the old changeset from 2007 for this part of the code?
[18 Apr 2014 20:42] Hartmut Holzgraefe
same with local 5.7 checkout: bzr annotate still shows the old chageset
but: "bzr log client/mysqlcheck.c" shows changesets 7416 and 7481 which both refer to "Bug #16064833: MYSQLCHECK HANDLES TABLE NAMES WITH DOTS INCORRECTLY"

http://bazaar.launchpad.net/~mysql/mysql-server/5.7/revision/7416
http://bazaar.launchpad.net/~mysql/mysql-server/5.7/revision/7481

any idea why "bzr annotate" is failing to show the correct changeset here?
bzr bug or some local corruption of the 5.7 tree?
[18 Apr 2014 21:07] Hartmut Holzgraefe
bzr problem now filed as http://bugs.mysql.com/bug.php?id=72389