From ecdf97924cbcf39e5be01a9c2acdb1d06f031d23 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 9 Dec 2018 16:53:19 +0200 Subject: [PATCH] Fixed that CREATE TABLE code used the right create_info - The old code used the original create_info from lex, not the new one that includes more information (like OPT_OR_REPLACE). The bug was not discovered as the code in lock_table_named() only checked for OPT_OR_REPLACE in case of timeout errors. As lock_table_names will be fixed as part of BACKUP STAGE's, there is no changes in lock_table_names() in this commit. - Removed also the 'temporary' copy of statement flags to thd for lock_table_names() --- sql/sql_parse.cc | 4 ---- sql/sql_table.cc | 7 +------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3b2e57abcf5..5193524ca05 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4186,11 +4186,7 @@ mysql_execute_command(THD *thd) goto end_with_restore_list; } - /* Copy temporarily the statement flags to thd for lock_table_names() */ - uint save_thd_create_info_options= thd->lex->create_info.options; - thd->lex->create_info.options|= create_info.options; res= open_and_lock_tables(thd, create_info, lex->query_tables, TRUE, 0); - thd->lex->create_info.options= save_thd_create_info_options; if (unlikely(res)) { /* Got error or warning. Set res to 1 if error */ diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 16f2a0a0b70..5aacf8bf4d6 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5543,12 +5543,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, properly isolated from all concurrent operations which matter. */ - /* Copy temporarily the statement flags to thd for lock_table_names() */ - // QQ: is this really needed??? - uint save_thd_create_info_options= thd->lex->create_info.options; - thd->lex->create_info.options|= create_info->options; - res= open_tables(thd, &thd->lex->query_tables, ¬_used, 0); - thd->lex->create_info.options= save_thd_create_info_options; + res= open_tables(thd, *create_info, &thd->lex->query_tables, ¬_used, 0); if (res) {