1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +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

@@ -4552,7 +4552,8 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
*/
if (open_and_lock_tables(thd, thd->lex->query_tables, FALSE, 0))
{
result= TRUE;
/* is_error() may be 0 if table existed and we generated a warning */
result= thd->is_error();
goto end;
}
@@ -4747,7 +4748,10 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
properly isolated from all concurrent operations which matter.
*/
if (open_tables(thd, &thd->lex->query_tables, &not_used, 0))
{
res= thd->is_error();
goto err;
}
src_table->table->use_all_columns();
DEBUG_SYNC(thd, "create_table_like_after_open");