Bug #35234 CREATE TEMPORARY TABLE allows creation of tables in non-existing databases
Submitted: 11 Mar 2008 22:46 Modified: 11 Mar 2008 23:08
Reporter: Justin Swanhart Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:4.1, 5.0, 5.1 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[11 Mar 2008 22:46] Justin Swanhart
Description:
localhost:(none)> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema | 
| test               | 
+--------------------+
2 rows in set (0.00 sec)

localhost:(none)> create temporary table x.xy (c int);
Query OK, 0 rows affected (0.00 sec)

localhost:(none)> desc x.xy;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| c     | int(11) | YES  |     | NULL    |       | 
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)

I'm not sure if this behavior has negative consequences, but it definitely results in unexpected behavior.

How to repeat:
Create a TEMPORARY table in a database that does not exist.  

Suggested fix:
Don't allow temporary tables to be created in non-existing databases.
[11 Mar 2008 23:08] Marc ALFF
There is a bug report already for this issue,
please see Bug#28902.

Closed as a duplicate.

Thanks for the bug report.