1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Fixed the CREATE TABLE IF EXIST generates warnings instead of errors

mysql-test/r/create.result:
  Updated test results
mysql-test/t/create.test:
  Updated test
sql/sql_base.cc:
  Use push_internal_handler/pop_internal_handler to avoid errors & warnings instead of clear_error
  Give a warnings instead of an error for CREATE TABLE IF EXISTS
sql/sql_parse.cc:
  Check if we failed because of table exists (can only happen from create)
sql/sql_table.cc:
  Check if we failed because of table exists (can only happen from create)
This commit is contained in:
Michael Widenius
2012-12-17 22:34:56 +02:00
parent d7a0148758
commit 2dbce3d089
5 changed files with 53 additions and 24 deletions

View File

@ -2512,7 +2512,14 @@ case SQLCOM_PREPARE:
goto end_with_restore_list;
}
if (!(res= open_and_lock_tables(thd, lex->query_tables, TRUE, 0)))
res= open_and_lock_tables(thd, lex->query_tables, TRUE, 0);
if (res)
{
/* Got error or warning. Set res to 1 if error */
if (!(res= thd->is_error()))
my_ok(thd); // CREATE ... IF NOT EXISTS
}
else
{
/* The table already exists */
if (create_table->table)