Bug #11493 Alter table rename to default database does not work without db name qualifying
Submitted: 22 Jun 2005 3:01 Modified: 1 Sep 2005 0:10
Reporter: KimSeong Loh (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.12 and 5.0.7 OS:Any (all)
Assigned to: Ingo Strüwing CPU Architecture:Any

[22 Jun 2005 3:01] KimSeong Loh
Description:
Renaming or moving table using ALTER TABLE ... RENAME from 1 database to the default database does not work without qualifying the database name in the target table name.

How to repeat:
CREATE DATABASE db1;
CREATE DATABASE db2;
USE db1
CREATE TABLE  t (i int);
ALTER TABLE t RENAME db2.t;

Table t moved to database db2.

ALTER TABLE db2.t RENAME t;

This does not move table t back to database db1, which is the default database. Need to use

ALTER TABLE db2.t RENAME db1.t;

to successfully moved table t to database db1.

Rename table works fine without the database qualifier.
RENAME TABLE db2.t TO t;
is able to move the table t from db2 to the default database.
[22 Jun 2005 11:04] Vasily Kishkin
Tested on Win 2000 Sp4, MySQL server 5.0.8 beta
[22 Jun 2005 17:12] Victoria Reznichenko
Verified on Linux too.
[9 Aug 2005 12:57] 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/internals/28066
[29 Aug 2005 14:54] 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/internals/28980
[30 Aug 2005 12:38] Ingo Strüwing
Pushed to 4.1.15 and 5.0.12.
[1 Sep 2005 0:10] Paul Dubois
Noted in 4.1.15, 5.0.12 changelogs.