Bug #26703 DROP DATABASE fails if database contains a #mysql50# table with backticks
Submitted: 27 Feb 2007 23:36 Modified: 14 Apr 2008 19:39
Reporter: Jan Kneschke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1.12 OS:Linux (linux)
Assigned to: Chad MILLER CPU Architecture:Any
Tags: Contribution

[27 Feb 2007 23:36] Jan Kneschke
Description:
You can't drop a mysql50 legacy-table if it contains a backtick.

It works fine for non-legacy tables with backticks, for the legacy tables without backticks.

How to repeat:
root@localhost [(none)]> create database t1;
Query OK, 1 row affected (0.00 sec)

root@localhost [(none)]> use t1;
Database changed
root@localhost [t1]> create table `#mysql50#abc``def` ( id int );
Query OK, 0 rows affected (0.08 sec)

root@localhost [t1]> drop database t1;
ERROR 1010 (HY000): Error dropping database (can't rmdir './t1', errno: 39)

Suggested fix:
don't stumble over the backtick.
[28 Feb 2007 0:26] MySQL Verification Team
Thank you for the bug report.
[30 Oct 2007 10:11] Sergei Golubchik
there's a patch: http://lists.mysql.com/internals/35142
[7 Mar 2008 16:40] 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/43609

ChangeSet@1.2561, 2008-03-07 11:39:24-05:00, cmiller@zippy.cornsilk.net +3 -0
  Bug#26703: DROP DATABASE fails if database contains a #mysql50# \
  	table with backticks
  
  (Thanks to Lu Jingdong, though I did not take his patch directly, as
  it contained a significant flaw.)
  
  It wasn't a backtick/parsing problem.  We merely didn't anticipate
  and allocate enough space to handle the optional "#mysql50#" table-
  name prefix. 
  
  Now, allocate that extra space in case we need it when we look up 
  a legacy table to get its file's name.
[12 Mar 2008 16:41] 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/43865

ChangeSet@1.2561, 2008-03-12 12:40:12-04:00, cmiller@zippy.cornsilk.net +3 -0
  Bug#26703: DROP DATABASE fails if database contains a #mysql50# \
  	table with backticks
  
  (Thanks to Lu Jingdong, though I did not take his patch directly, as
  it contained a significant flaw.)
  
  It wasn't a backtick/parsing problem.  We merely didn't anticipate
  and allocate enough space to handle the optional "#mysql50#" table-
  name prefix. 
  
  Now, allocate that extra space in case we need it when we look up 
  a legacy table to get its file's name.
[12 Mar 2008 20:28] Chad MILLER
Queued to 5.1-build and 6.0-build.
[27 Mar 2008 22:03] Bugs System
Pushed into 5.1.24-rc
[28 Mar 2008 11:10] Bugs System
Pushed into 6.0.5-alpha
[14 Apr 2008 19:39] Paul DuBois
Noted in 5.1.24, 6.0.5 changelog.

DROP DATABASE failed for attempts to drop databases with names that
contained the legacy #mysql50# name prefix.