Description:
Create database db1 and table t1 in db1
Create temporary table t1(same name as already existing table t1)
Insert some data contents in both table t1 and temp table t1
Drop the database db1. This will fail due to presence of temp table t1.
An alternative to this is drop table t1 and then drop the database. Drop db will pass this time.
How to repeat:
Here is the test case for this,
CREATE DATABASE db1;
USE db1;
CREATE TABLE t1(id INT);
INSERT INTO t1 VALUES(1),(2);
CREATE TEMPORARY TABLE t1(id INT);
INSERT INTO t1 VALUES(3);
--error ER_DB_DROP_RMDIR
DROP DATABASE db1; # This will fail
#Now drop the table and then drop database,
DROP TABLE t1;
DROP DATABASE db1;
The result file is,
------------------
CREATE DATABASE db1;
USE db1;
CREATE TABLE t1(id INT);
INSERT INTO t1 VALUES(1),(2);
CREATE TEMPORARY TABLE t1(id INT);
INSERT INTO t1 VALUES(3);
DROP DATABASE db1;
ERROR HY000: Error dropping database (can't rmdir './db1', errno: 39)
DROP TABLE t1;
DROP DATABASE db1;
If you notice, test does not pass when DROP DATABASE is used at first instant. Only after using DROP TABLE, the DROP DATABASE passes.