Bug #4724 'CREATE DATABASE IF NOT EXISTS ...' fails on windows if database already exists
Submitted: 23 Jul 2004 15:12 Modified: 23 Jul 2004 16:26
Reporter: Mark Matthews Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.3 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[23 Jul 2004 15:12] Mark Matthews
Description:
This came to me from Matt Raible, but I've tested it on Windows and Linux with 4.1.3 release builds. It doesn't fail on Linux.

It appears that if a database already exists, "CREATE DATABASE IF NOT EXISTS ...' will fail with error number 17 "ERROR_NOT_SAME_DEVICE":

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 437 to server version: 4.1.3-beta-nt-max

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database if not exists appfuse;
Query OK, 1 row affected (0.14 sec)

mysql> create database if not exists appfuse;
ERROR 1006 (HY000): Can't create database 'appfuse' (errno: 17)
mysql>

How to repeat:
Issue 'create database if not exists ....' twice in a row on windows on MySQL-4.1.3.
[23 Jul 2004 16:26] MySQL Verification Team
I was able to repeat with version 4.1.3:

mysql> select version();
+--------------------+
| version()          |
+--------------------+
| 4.1.3b-beta-nt-log |
+--------------------+
1 row in set (0.03 sec)

mysql> create database if not exists appfuse;
ERROR 1006 (HY000): Can't create database 'appfuse' (errno: 17)

However with server built with source tree 3-4 days older the bug
don't exists anymore:

mysql> select version();
+-------------------+
| version()         |
+-------------------+
| 4.1.4-beta-nt-log |
+-------------------+
1 row in set (0.04 sec)

mysql> create database if not exists appfuse;
Query OK, 0 rows affected (0.01 sec)

mysql> create database if not exists appfuse;
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> create database if not exists appfuse;
Query OK, 0 rows affected (0.01 sec)

Sorry I wasn't able for to find how that was fixed after the 4.1.3 release.