summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-03-22 20:04:59 -0700
committerunknown <sasha@mysql.sashanet.com>2001-03-22 20:04:59 -0700
commit250bb75a50696a2f7c3358684e9d25279f84ad46 (patch)
treee74a6586b8466fc366b1919f94e9310b3fdb6596 /sql/sql_base.cc
parentfc9c0ad83eecb909fd4f5a08e3b8bfb6c8431159 (diff)
downloadmariadb-git-250bb75a50696a2f7c3358684e9d25279f84ad46.tar.gz
fixed bug on re-open of temp tables after FLUSH in the middle of open
added flush test case, but had to comment the fun part out because it does not work for some reason - will investigate why. sql/sql_base.cc: fixed bugs on re-open of temp tables after FLUSH in the middle of open
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index c235ac6575a..801ef63dcf3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -32,6 +32,7 @@
TABLE *unused_tables; /* Used by mysql_test */
HASH open_cache; /* Used by mysql_test */
+static void reset_query_id_on_temp_tables(THD* thd);
static int open_unireg_entry(THD *thd,TABLE *entry,const char *db,
const char *name, const char *alias, bool locked);
@@ -1314,6 +1315,12 @@ err:
}
+static void reset_query_id_on_temp_tables(THD* thd)
+{
+ for(TABLE* tmp = thd->temporary_tables; tmp; tmp = tmp->next)
+ tmp->query_id = 0;
+}
+
/*****************************************************************************
** open all tables in list
*****************************************************************************/
@@ -1339,6 +1346,9 @@ int open_tables(THD *thd,TABLE_LIST *start)
{
/* close all 'old' tables used by this thread */
pthread_mutex_lock(&LOCK_open);
+ // if query_id is not reset, we will get an error
+ // re-opening a temp table
+ reset_query_id_on_temp_tables(thd);
thd->version=refresh_version;
TABLE **prev_table= &thd->open_tables;
bool found=0;