summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-03-20 15:49:55 +0100
committerunknown <guilhem@mysql.com>2004-03-20 15:49:55 +0100
commit331ff0d8f5e092b9672f66d135d6209897b25846 (patch)
treede98e869d6676ebf70cea261ebb9af0682a6c51d
parent3e5f1eaecf21e3b2fde0c86838d6740a939b921f (diff)
parent02d2d70cb1e7f8b08e969e59cfc1f46ad950c07e (diff)
downloadmariadb-git-331ff0d8f5e092b9672f66d135d6209897b25846.tar.gz
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
-rw-r--r--mysql-test/r/drop_temp_table.result4
-rw-r--r--sql/sql_base.cc5
2 files changed, 5 insertions, 4 deletions
diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result
index 6b18b54335d..fa3a72d9472 100644
--- a/mysql-test/r/drop_temp_table.result
+++ b/mysql-test/r/drop_temp_table.result
@@ -13,6 +13,6 @@ Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use `test`; create database `drop-temp+table-test`
master-bin.001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int)
-master-bin.001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE `drop-temp+table-test`.`table:name`
-master-bin.001 365 Query 1 365 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
+master-bin.001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
+master-bin.001 375 Query 1 375 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
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)
{