Bug #6632 Command "CREATE TABLE xyz" crashs if database exists ?

Submitted: 15 Nov 2004 11:38 Modified: 19 Nov 2004 0:17
Reporter: Jaromir Prinzler Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S1 (Critical)
Version:v4.1.7-embedded OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[15 Nov 2004 11:38] Jaromir Prinzler
Description:
Helo !

I hope you can understand me ? My english is bad ;-)

Now i use the embedded server version (4.1.7) from mysql.

When i log on to the server and execute first time the query
"CREATE DATABASE mydb" the server creates the database. fine !

Now i restart my program or not and send the same query to the server
"CREATE DATABASE mydb" the command "mysql_query" or "mysql_real_query"
crash the application with an exeception error "The thread tried to read or write to a virtual address for which it does not have the appropriate access".

When i use follow sequence "CREATE DATABASE IF NOT EXISTS mydb" the application crash nothing. This error exist only on the emmbedded version. When i use the real server on my suse linux 8.1 system the applikation does not crashing.

How to repeat:
Use the embedded server version from mysql, logon and call :

CREATE DATABASE mydb;
CREATE DATABASE mydb; <--- CRASHING NOW !

CREATE DATABASE IF NOT EXISTS mydb; <--- CRASHING NOT !

Suggested fix:
I think it is an filehandling problem on windows (xp) ?
[16 Nov 2004 16:52] MySQL Verification Team
I did small application modifying the sample in our Manual
for to create a database called mydb:

C:\mysql>mysample.exe
Affected rows: 1
>> mydb
>> mysql
>> test

C:\mysql>mysample.exe
Error: Can't create database 'mydb'; database existsAffected rows: -1
>> mydb
>> mysql
>> test
[17 Nov 2004 8:29] Jaromir Prinzler
My little sample for compileing under windows with gcc ! This crashs when you it called and db exists ?!

Attachment: littlesample.zip (application/x-zip-compressed, text), 1.06 KiB.

[18 Nov 2004 7:59] Jaromir Prinzler
Hello !

I have your send this litte snipped. My compiler is gcc 2.95.
When i use this code with real mysql server - it works fine ;-)
The standalone version crashs on the second "CREATE DATABASE" 
without "IF NOT EXISTS". Thats ugly !

Have a nice Day !

Greetings from berlin.

Jaromir Prinzler
[19 Nov 2004 0:17] MySQL Verification Team
Sorry I wasn't able for to test your code because I don't have
GCC on Windows and for test I need to use the VC++ compiler
which is our official compiler for the release binaries.
Your sample doesn't compile in VC++ 6.0.

Please look the sample in our Manual:

http://dev.mysql.com/doc/mysql/en/libmysqld_example.html

and just change the query for create database.....

and compile it with GCC and verify if strill you get that
crash.

Thanks in advance.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.