Bug #45914 Restore errors if there is a privilege on a quoted database name
Submitted: 2 Jul 2009 13:55 Modified: 11 Aug 2009 12:42
Reporter: Jørgen Løland Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:5.4.4 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[2 Jul 2009 13:55] Jørgen Løland
Description:
Restore errors if a backup image contains a privilege on a database who's name is in quotes:

CREATE DATABASE `my-database`;
CREATE USER joe;
GRANT SELECT ON `my-database`.* TO joe;

BACKUP DATABASE `my-database` TO '1.bup';
DROP DATABASE `my-database`;
RESTORE FROM '1.bup';
### Errors

How to repeat:
> CREATE DATABASE `my-database`;
> CREATE USER joe;
> GRANT SELECT ON `my-database`.* TO joe;
> BACKUP DATABASE `my-database` TO '1.bup';
backup_id
276
> DROP DATABASE `my-database`;
> RESTORE FROM '1.bup';
ERROR HY000: Could not execute grant '`my-database`.`<empty> 1`'.
> SHOW WARNINGS;
Level	Code	Message
Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-database.* TO 'joe'@'%'' at line 1
Error	1751	Could not execute grant '`my-database`.`<empty> 1`'.
Warning	1776	Operation aborted - data might be corrupted

Suggested fix:
Restore needs to succeed.
[10 Aug 2009 20:34] Chuck Bell
Cannot repeat. Creating regression test case. Will submit a patch that contains only the test case.
[10 Aug 2009 21:42] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/80493

2857 Chuck Bell	2009-08-10
      BUG#45914 : Restore errors if there is a privilege on a quoted database name
      
      The bug can no longer be repeated. This patch adds a regression
      test case to ensure the problem doesn't return.
     @ mysql-test/suite/backup/r/backup_objects.result
        Result file with new test case.
     @ mysql-test/suite/backup/t/backup_objects.test
        Added test that case executes backup and restore of a database using
        quoted name and privileges assigned to a user.
[11 Aug 2009 6:11] Rafal Somla
Good to push.
[11 Aug 2009 12:42] Chuck Bell
It has been revealed that BUG#43444 fixed this problem and a test case was included in that patch. Thus, this has been solved by BUG#43444.