1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

WL#5370 Keep forward-compatibility when changing

'CREATE TABLE IF NOT EXISTS ... SELECT' behaviour
BUG#47132, BUG#47442, BUG49494, BUG#23992 and BUG#48814 will disappear
automatically after the this patch.
BUG#55617 is fixed by this patch too.
            
This is the 5.5 part.
It implements:
- 'CREATE TABLE IF NOT EXISTS ... SELECT' statement will not insert
  anything and binlog anything if the table already exists.
  It only generate a warning that table already exists.
- A couple of test cases for the behavior changing.
This commit is contained in:
unknown
2010-08-18 17:35:41 +08:00
parent e28d6ee66a
commit d0d8bbed5e
31 changed files with 806 additions and 302 deletions

View File

@@ -4038,7 +4038,6 @@ bool mysql_create_table_no_lock(THD *thd,
{
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
create_info->table_existed= 1; // Mark that table existed
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
alias);
@@ -4110,7 +4109,6 @@ bool mysql_create_table_no_lock(THD *thd,
}
thd_proc_info(thd, "creating table");
create_info->table_existed= 0; // Mark that table is created
#ifdef HAVE_READLINK
{
@@ -4205,7 +4203,6 @@ warn:
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
alias);
create_info->table_existed= 1; // Mark that table existed
goto unlock_and_end;
}
@@ -4469,11 +4466,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
non-temporary table.
*/
DBUG_ASSERT((create_info->options & HA_LEX_CREATE_TMP_TABLE) ||
local_create_info.table_existed ||
thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db,
table->table_name,
MDL_EXCLUSIVE));
/*
We have to write the query before we unlock the tables.
*/