From 9d7014c07be2511194bed4f948aa67200cda40da Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Sun, 28 Sep 2003 18:31:49 +0200 Subject: [PATCH] Fix for BUG#1345 "SQL Syntax Error in binarylog with DROP TABLES": it's just backquoting the db's and table's names when writing DROP TEMPORARY TABLE to the binlog when a connection ends. A testcase for this. --- mysql-test/r/drop_temp_table.result | 11 +++++++++++ mysql-test/t/drop_temp_table.test | 13 +++++++++++++ sql/sql_base.cc | 14 ++++++-------- 3 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 mysql-test/r/drop_temp_table.result create mode 100644 mysql-test/t/drop_temp_table.test diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result new file mode 100644 index 00000000000..40e363dbf00 --- /dev/null +++ b/mysql-test/r/drop_temp_table.result @@ -0,0 +1,11 @@ +reset master; +create database `drop-temp+table-test`; +use `drop-temp+table-test`; +create temporary table `table:name` (a int); +show binlog events; +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` +drop database `drop-temp+table-test`; diff --git a/mysql-test/t/drop_temp_table.test b/mysql-test/t/drop_temp_table.test new file mode 100644 index 00000000000..4849e998bf5 --- /dev/null +++ b/mysql-test/t/drop_temp_table.test @@ -0,0 +1,13 @@ +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +connection con1; +reset master; +create database `drop-temp+table-test`; +use `drop-temp+table-test`; +create temporary table `table:name` (a int); +disconnect con1; +connection con2; +let $VERSION=`select version()`; +--replace_result $VERSION VERSION +show binlog events; +drop database `drop-temp+table-test`; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 43718e5d93b..1010378825f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -561,15 +561,13 @@ void close_temporary_tables(THD *thd) { // skip temporary tables not created directly by the user if (table->real_name[0] != '#') - { - /* - Here we assume table_cache_key always starts - with \0 terminated db name - */ found_user_tables = 1; - } - end = strxmov(end,table->table_cache_key,".", - table->real_name,",", NullS); + /* + Here we assume table_cache_key always starts + with \0 terminated db name + */ + end = strxmov(end,"`",table->table_cache_key,"`", + ".`",table->real_name,"`,", NullS); } next=table->next; close_temporary(table);