Bug #26704 Failing DROP DATABASE brings mysql-client out of sync
Submitted: 28 Feb 2007 0:41 Modified: 12 Nov 19:59
Reporter: Jan Kneschke
Status: Closed
Category:Server: DDL Severity:S3 (Non-critical)
Version:5.1.12/5.1BK OS:Linux (linux)
Assigned to: Alexander Nozdrin Target Version:6.0
Tags: Contribution
Triage: Triaged: D3 (Medium)

[28 Feb 2007 0:41] Jan Kneschke
Description:
This bug is follow up of bug #26703 where the DROP DATABASE fails on mysql50 legacy
tables with backticks.

If DROP DATABASE fails, the connection is loosing the selected database, but the client
still shows the old database as selected.

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)
root@localhost [t1]> drop table `#mysql50#abc``def`;
ERROR 1046 (3D000): No database selected
root@localhost [t1]> use t1;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
root@localhost [t1]> drop table `#mysql50#abc``def`;
Query OK, 0 rows affected (0.00 sec)

root@localhost [t1]> drop database t1;
Query OK, 0 rows affected (0.00 sec)

Suggested fix:
Either keep the database as selected (it still exists) or make the client show (none) for
the db-name.
[28 Feb 2007 1:00] Miguel Solorzano
Thank you for the bug report. Verified as described.
[1 Nov 2007 11:37] Sergei Golubchik
patch: http://lists.mysql.com/internals/35145
[20 Feb 2008 2:26] Jim Winstead
This is actually a server problem, as the proposed patch shows. Re-opening so a complete
patch (with test case) will get done.
[28 Mar 2008 21:00] 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/44620

ChangeSet@1.2579, 2008-03-28 23:02:36+03:00, anozdrin@quad.opbmk +3 -0
  A fix for Bug#26704: Failing DROP DATABASE brings
  mysql-client out of sync.
  
  The problem was that we changed current database w/o caring
  whether it was dropped successfully or not.
  
  The fix is not to change current database if we failed to drop it.
[19 May 2008 13:51] Konstantin Osipov
Push into 6.0 please.
[29 May 2008 19:01] 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/47215
[30 May 2008 7:38] Alexander Nozdrin
Pushed into 6.0-runtime.
[1 Dec 2008 11:24] Alexander Nozdrin
Pushed into 6.0.5.
[1 Dec 2008 17:33] Paul DuBois
Noted in 6.0.5 changelog.

The default database is no longer changed to NULL ("no database") if
DROP DATABASE for that database failed.
[9 Oct 16:58] Alexander Nozdrin
Pushed into 5.5.0.
[12 Oct 17:10] Paul DuBois
Noted in 5.5.0 changelog.
[31 Oct 9:18] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091031081410-qkxmjsdzjmj840aq) (version
source revid:guilhem@mysql.com-20091010123356-qfouds7ucvkvbczt) (merge vers:
6.0.14-alpha) (pib:13)
[12 Nov 9:16] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091110093229-0bh5hix780cyeicl) (version
source revid:mikael@mysql.com-20091102100915-a2nbfxaqprpgptfw) (merge vers: 5.5.0-beta)
(pib:13)