summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 9d3ed11725c..86f81dd001a 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5979,7 +5979,8 @@ finish:
lex->unit.cleanup();
/* close/reopen tables that were marked to need reopen under LOCK TABLES */
- if (! thd->lex->requires_prelocking())
+ if (unlikely(thd->locked_tables_list.some_table_marked_for_reopen) &&
+ !thd->lex->requires_prelocking())
thd->locked_tables_list.reopen_tables(thd, true);
if (! thd->in_sub_stmt)