From 1f08a518589b79e9dd2897e6ebdb237bcc4c2221 Mon Sep 17 00:00:00 2001 From: unknown <sanja@montyprogram.com> Date: Fri, 21 Jun 2013 15:17:48 +0300 Subject: [PATCH] Case when we close temporary table which was not opened in its engine (ALTER TABLE) fixed. --- sql/sql_base.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index a2220a59470..e1a87138656 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2360,8 +2360,13 @@ void close_temporary(TABLE *table, bool free_share, bool delete_table) DBUG_PRINT("tmptable", ("closing table: '%s'.'%s'", table->s->db.str, table->s->table_name.str)); - /* in_use is not set for replication temporary tables during shutdown */ - if (table->in_use) + /* + in_use is not set for replication temporary tables during shutdown. + + table->file->get_table() could not be set for ALTER table + when we do not open it in engine. + */ + if (table->file->get_table() && table->in_use) { table->file->update_global_table_stats(); table->file->update_global_index_stats(); -- 2.30.9