summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorguilhem@mysql.com <>2004-03-20 15:49:17 +0100
committerguilhem@mysql.com <>2004-03-20 15:49:17 +0100
commitd89f148de62ae0b59a6bb8dd12a25451315a8605 (patch)
tree35d9b57b12adbea7484a13a7dc6549949b23ebba /sql
parent6948c9d9bea2587f73a093cbcb9ddbe2a469a429 (diff)
downloadmariadb-git-d89f148de62ae0b59a6bb8dd12a25451315a8605.tar.gz
The automatic DROP TEMPORARY TABLE is now DROP TEMPORARY TABLE IF EXISTS,
this is better in this case: - imagine user1 has created a temp table - imagine user2 does FLUSH TABLES WITH READ LOCK, then takes a backup, then RESET MASTER then UNLOCK TABLES, like mysqldump --first-slave - then in the binlog you will finally have the DROP TEMPORARY TABLE, but not the CREATE TEMPORARY TABLE, so when you later restore with mysqlbinlog|mysql, mysql will complain that table does not exist. Replication was already protected of this (it processes DROP TEMPORARY TABLE as if there was a IF EXISTS), now I add it directly to the query for mysqlbinlog|mysql to work.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_base.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index dac8da12065..9f1caca55bc 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -547,7 +547,7 @@ void close_temporary_tables(THD *thd)
return;
LINT_INIT(end);
- query_buf_size= 50; // Enough for DROP ... TABLE
+ query_buf_size= 50; // Enough for DROP ... TABLE IF EXISTS
for (table=thd->temporary_tables ; table ; table=table->next)
/*
@@ -558,7 +558,8 @@ void close_temporary_tables(THD *thd)
query_buf_size+= table->key_length+1;
if ((query = alloc_root(&thd->mem_root, query_buf_size)))
- end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE ");
+ // Better add "if exists", in case a RESET MASTER has been done
+ end=strmov(query, "DROP /*!40005 TEMPORARY */ TABLE IF EXISTS ");
for (table=thd->temporary_tables ; table ; table=next)
{