views:

177

answers:

3

Using the command:

CREATE TABLE IF NOT EXISTS `test`.`t1` (
    `col` VARCHAR(16) NOT NULL
) ENGINE=MEMORY;

Running this twice in the MySQL Query Browser results in:

Table 't1' already exists Error 1050

I would have thought that creating the table "IF NOT EXISTS" would not throw errors. Am I missing something or is this a bug? I am running version 5.1. Thanks.

+1  A: 

Works fine for me in 5.0.27

I just get a warning (not an error) that the table exists;

Eli
Thanks Eli, you're right. It is my 3rd party client software that is raising this warning as an exception for me which is my problem.
A: 

I have some similar weird lameness around the same problem.

http://stackoverflow.com/questions/2887764/cant-delete-a-mysql-table-error-1050

Any advice?

doublejosh
A: 

As already stated, it's a warning not an error, but (if like me) you want things to run without warnings, you can disable that warning, then re-enable it again when you're done.

SET sql_notes = 0;      -- Temporarily disable the "Table already exists" warning
CREATE TABLE IF NOT EXISTS ...
SET sql_notes = 1;      -- And then re-enable the warning again
gdt