List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:August 11 2010 10:39am
Subject:bzr commit into mysql-5.5-bugfixing branch (alfranio.correia:3173)
Bug#53452
View as plain text  
#At file:///home/acorreia/workspace.sun/repository.mysql.new/bzrwork/tmp/BUG-53452/mysql-5.5-bugfixing/ based on revid:alfranio.correia@stripped

 3173 Alfranio Correia	2010-08-11
      BUG#53452 Inconsistent behavior of binlog_direct_non_transactional_updates with
      temp table
                  
      This patch introduces two key changes in the replication's behavior.
                  
      Firstly, it reverts part of BUG#51894 which puts any update to temporary tables
      into the trx-cache. Now, updates to temporary tables are handled according to
      the type of their engines as a regular table.
                  
      Secondly, an unsafe mixed statement, (i.e. a statement that access transactional
      table as well non-transactional or temporary table, and writes to any of them),
      are written into the trx-cache in order to minimize errors in the execution when
      the statement logging format is in use.
                  
      Such changes has a direct impact on which statements are classified as unsafe
      statements and thus part of BUG#53259 is reverted.

    removed:
      mysql-test/suite/rpl/t/rpl_mixed_row_innodb.test
    modified:
      mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
      mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
      mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
      mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test
      mysql-test/r/ctype_cp932_binlog_stm.result
      mysql-test/r/mysqlbinlog.result
      mysql-test/suite/binlog/r/binlog_database.result
      mysql-test/suite/binlog/r/binlog_innodb_row.result
      mysql-test/suite/binlog/r/binlog_row_binlog.result
      mysql-test/suite/binlog/r/binlog_row_drop_tbl.result
      mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result
      mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
      mysql-test/suite/binlog/r/binlog_stm_binlog.result
      mysql-test/suite/binlog/r/binlog_stm_blackhole.result
      mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result
      mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
      mysql-test/suite/binlog/r/binlog_stm_row.result
      mysql-test/suite/perfschema/r/binlog_mix.result
      mysql-test/suite/perfschema/r/binlog_row.result
      mysql-test/suite/perfschema/r/binlog_stmt.result
      mysql-test/suite/rpl/r/rpl_conditional_comments.result
      mysql-test/suite/rpl/r/rpl_drop_if_exists.result
      mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
      mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result
      mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_row_drop.result
      mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
      mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result
      mysql-test/suite/rpl/r/rpl_row_log.result
      mysql-test/suite/rpl/r/rpl_row_log_innodb.result
      mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
      mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result
      mysql-test/suite/rpl/r/rpl_server_id.result
      mysql-test/suite/rpl/r/rpl_sp.result
      mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
      mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result
      mysql-test/suite/rpl/r/rpl_stm_log.result
      mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result
      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result
      mysql-test/suite/rpl/t/rpl_stm_innodb.test
      mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result
      sql/log.cc
      sql/log_event.cc
      sql/mysqld.cc
      sql/sql_base.cc
      sql/sql_base.h
      sql/sql_class.cc
      sql/sql_insert.cc
      sql/sql_lex.cc
      sql/sql_lex.h
      sql/sql_table.cc
      sql/sql_table.h
=== modified file 'mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test'
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test	2010-07-16 18:25:38 +0000
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test	2010-08-11 10:39:26 +0000
@@ -377,7 +377,8 @@ reset master;
 
 begin; 
 insert into ti values (1); 
-insert into ti values (2) ; 
+insert into ti values (2) ;
+# This is SAFE because --binlog-direct-non-transactional-updates=FALSE
 insert into tt select * from ti;
 rollback;
 

=== modified file 'mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test'
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test	2010-05-04 19:31:49 +0000
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test	2010-08-11 10:39:26 +0000
@@ -24,6 +24,7 @@ reset master;
 begin; 
 insert into ti values (1); 
 insert into ti values (2) ; 
+# This is SAFE because --binlog-direct-non-transactional-updates=FALSE
 insert into tt select * from ti;
 rollback;
 

=== modified file 'mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc'
--- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc	2010-06-30 19:37:41 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc	2010-08-11 10:39:26 +0000
@@ -725,7 +725,7 @@ while (`SELECT HEX(@commands) != HEX('')
       --eval SET @check_temp='$available_n_temp'
       --eval SET @table_temp='$table_n'
       SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
-      --let $available_t_temp= `SELECT @check_temp`
+      --let $available_n_temp= `SELECT @check_temp`
 
       --enable_query_log
       --eval DROP TEMPORARY TABLE $table_t, $table_n

=== modified file 'mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test'
--- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test	2010-06-30 19:37:41 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test	2010-08-11 10:39:26 +0000
@@ -378,9 +378,12 @@ sync_slave_with_master;
 
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-slave.sql
---diff_files $MYSQLD_DATADIR/test-temporary-master.sql $MYSQLD_DATADIR/test-temporary-slave.sql
+if (`select @@session.binlog_format != 'STATEMENT'`)
+{
+  --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-master.sql
+  --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLD_DATADIR/test-temporary-slave.sql
+  --diff_files $MYSQLD_DATADIR/test-temporary-master.sql $MYSQLD_DATADIR/test-temporary-slave.sql
+}
 
 --echo #########################################################################
 --echo #                           CLEAN

=== modified file 'mysql-test/r/ctype_cp932_binlog_stm.result'
--- a/mysql-test/r/ctype_cp932_binlog_stm.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result	2010-08-11 10:39:26 +0000
@@ -47,7 +47,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'),  NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'),  NAME_CONST('ind',47.93))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP PROCEDURE bug18293
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t4` /* generated by server */
 End of 5.0 tests
 SHOW BINLOG EVENTS FROM 490;
 ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error

=== modified file 'mysql-test/r/mysqlbinlog.result'
--- a/mysql-test/r/mysqlbinlog.result	2010-04-03 17:35:51 +0000
+++ b/mysql-test/r/mysqlbinlog.result	2010-08-11 10:39:26 +0000
@@ -28,7 +28,7 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-drop table if exists t1,t2,t3,t4,t5,t03,t04
+DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 create table t1 (word varchar(20))
@@ -229,7 +229,7 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-drop table if exists t1,t2,t3,t4,t5,t03,t04
+DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 create table t1 (word varchar(20))
@@ -628,7 +628,7 @@ SET TIMESTAMP=1000000000/*!*/;
 COMMIT
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
-drop table t1
+DROP TABLE `t1` /* generated by server */
 /*!*/;
 DELIMITER ;
 # End of log file

=== modified file 'mysql-test/suite/binlog/r/binlog_database.result'
--- a/mysql-test/suite/binlog/r/binlog_database.result	2010-04-20 09:10:43 +0000
+++ b/mysql-test/suite/binlog/r/binlog_database.result	2010-08-11 10:39:26 +0000
@@ -36,7 +36,8 @@ master-bin.000001	#	Query	#	#	drop datab
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table tt1, t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 FLUSH STATUS;
 set binlog_format=mixed;
 reset master;
@@ -76,7 +77,8 @@ master-bin.000001	#	Query	#	#	drop datab
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (1)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table tt1, t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 FLUSH STATUS;
 set binlog_format=row;
 reset master;
@@ -117,8 +119,8 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 FLUSH STATUS;
 show databases;
 Database

=== modified file 'mysql-test/suite/binlog/r/binlog_innodb_row.result'
--- a/mysql-test/suite/binlog/r/binlog_innodb_row.result	2010-04-20 09:10:43 +0000
+++ b/mysql-test/suite/binlog/r/binlog_innodb_row.result	2010-08-11 10:39:26 +0000
@@ -45,7 +45,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 ###############################################
 RESET MASTER;
 CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;

=== modified file 'mysql-test/suite/binlog/r/binlog_row_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result	2010-07-17 11:07:36 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result	2010-08-11 10:39:26 +0000
@@ -234,7 +234,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
 show binlog events in 'master-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Query	#	#	use `test`; drop table t1
+master-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 set @ac = @@autocommit;
 set autocommit= 0;
 reset master;
@@ -256,7 +256,7 @@ master-bin.000001	#	Write_rows	#	#	table
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 set @bcs = @@binlog_cache_size;
 set global binlog_cache_size=4096;
 reset master;
@@ -1086,7 +1086,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 reset master;
 CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
 USE bug39182;
@@ -1194,7 +1194,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE IF NOT EXISTS `t2` (
@@ -1229,7 +1229,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE IF NOT EXISTS `t2` (
@@ -1251,8 +1251,8 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.user)
 master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)

=== modified file 'mysql-test/suite/binlog/r/binlog_row_drop_tbl.result'
--- a/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result	2009-12-04 23:02:48 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result	2010-08-11 10:39:26 +0000
@@ -13,4 +13,4 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */

=== modified file 'mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result'
--- a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result	2010-06-29 10:54:58 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result	2010-08-11 10:39:26 +0000
@@ -28,11 +28,13 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	CREATE DATABASE `drop-temp+table-test`
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; CREATE TABLE t(c1 int)
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp3` /* generated by server */
-master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
 DROP DATABASE `drop-temp+table-test`;
 RESET MASTER;

=== modified file 'mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2010-07-17 11:07:36 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2010-08-11 10:39:26 +0000
@@ -286,7 +286,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1,t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1`,`t2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t0 (n int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t0)
@@ -383,12 +383,12 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE if exists t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
@@ -399,7 +399,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
@@ -448,8 +448,8 @@ master-bin.000001	#	Query	#	#	use `test`
   PRIMARY KEY (`a`)
 ) ENGINE=InnoDB
 master-bin.000001	#	Query	#	#	ROLLBACK
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 reset master;
 create table t1 (a int) engine=innodb;
 create table t2 (a int) engine=myisam;

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2010-07-17 11:07:36 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2010-08-11 10:39:26 +0000
@@ -143,7 +143,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 master-bin.000001	#	Rotate	#	#	master-bin.000002;pos=4
 show binlog events in 'master-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Query	#	#	use `test`; drop table t1
+master-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 set @ac = @@autocommit;
 set autocommit= 0;
 reset master;
@@ -162,7 +162,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (2)
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (3)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 set @bcs = @@binlog_cache_size;
 set global binlog_cache_size=4096;
 reset master;
@@ -591,7 +591,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (9999999999999999,14632475938453979136)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 reset master;
 CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
 USE bug39182;
@@ -637,7 +637,7 @@ DROP TEMPORARY TABLE tmp1;
 END
 master-bin.000001	#	Query	#	#	use `bug39182`; CREATE TEMPORARY TABLE tmp1
 SELECT * FROM t1 WHERE a LIKE CONCAT("%",  NAME_CONST('s1',_utf8'test' COLLATE 'utf8_unicode_ci'), "%")
-master-bin.000001	#	Query	#	#	use `bug39182`; DROP TEMPORARY TABLE tmp1
+master-bin.000001	#	Query	#	#	use `bug39182`; DROP TEMPORARY TABLE `tmp1` /* generated by server */
 DROP PROCEDURE p1;
 DROP TABLE t1;
 DROP DATABASE bug39182;
@@ -701,7 +701,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=127
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(null)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	use `test`; create table if not exists t2 select * from t1
 master-bin.000001	#	Query	#	#	use `test`; create temporary table tt1 (a int)
@@ -728,7 +728,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=127
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values(null)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	use `test`; create table if not exists t2 select * from t1
 master-bin.000001	#	Query	#	#	use `test`; create temporary table tt1 (a int)
@@ -742,7 +742,8 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1,t2,t3,tt1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_blackhole.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result	2010-08-11 10:39:26 +0000
@@ -107,7 +107,7 @@ select * from t3;
 a
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; drop table t1,t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1`,`t2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (a int) engine=blackhole
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; delete from t1 where a=10

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result	2010-02-04 22:08:08 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result	2010-08-11 10:39:26 +0000
@@ -12,4 +12,4 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES(1)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result	2010-06-29 10:54:58 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result	2010-08-11 10:39:26 +0000
@@ -34,12 +34,14 @@ master-bin.000001	#	Query	#	#	use `drop-
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp2(c1 int)
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; CREATE TEMPORARY TABLE tmp3(c1 int)
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; CREATE TABLE t(c1 int)
-master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp
-master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp
-master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS tmp, tmp1
-master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE tmp3
-master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
-master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TABLE IF EXISTS tmp2, t
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE `tmp3` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */
+master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */
 master-bin.000001	#	Query	#	#	use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
 DROP DATABASE `drop-temp+table-test`;
 RESET MASTER;

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result	2010-07-15 13:47:50 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result	2010-08-11 10:39:26 +0000
@@ -270,7 +270,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert into t2 values (20)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1,t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1`,`t2` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; create temporary table ti (a int) engine=innodb
 master-bin.000001	#	Query	#	#	ROLLBACK
@@ -378,11 +378,11 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 values (1,1),(1,2)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE if exists t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 values (3,3)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (4,4)
@@ -391,7 +391,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (5,5)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 values (6,6)
 master-bin.000001	#	Query	#	#	COMMIT
@@ -415,7 +415,8 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t2 values (101,101)
 master-bin.000001	#	Query	#	#	ROLLBACK
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1,t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `t2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 reset master;
 create table t1 (a int) engine=innodb;
 create table t2 (a int) engine=myisam;

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_row.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_row.result	2010-04-28 12:47:49 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_row.result	2010-08-11 10:39:26 +0000
@@ -59,8 +59,8 @@ RELEASE_LOCK('Bug#34306')
 # Show binlog events
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT)
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 LIKE t1
 master-bin.000001	#	Query	#	#	BEGIN

=== modified file 'mysql-test/suite/perfschema/r/binlog_mix.result'
--- a/mysql-test/suite/perfschema/r/binlog_mix.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/binlog_mix.result	2010-08-11 10:39:26 +0000
@@ -28,8 +28,8 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Update_rows	#	#	table_id: #
 master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table if exists test.t1
-master-bin.000001	#	Query	#	#	use `test`; drop table if exists test.t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table test.t1 (thread_id integer)
 master-bin.000001	#	Query	#	#	use `test`; create table test.t2 (name varchar(128))
 master-bin.000001	#	Query	#	#	BEGIN
@@ -40,8 +40,8 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table test.t1
-master-bin.000001	#	Query	#	#	use `test`; drop table test.t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (performance_schema.SETUP_INSTRUMENTS)
 master-bin.000001	#	Update_rows	#	#	table_id: #

=== modified file 'mysql-test/suite/perfschema/r/binlog_row.result'
--- a/mysql-test/suite/perfschema/r/binlog_row.result	2010-01-12 01:47:27 +0000
+++ b/mysql-test/suite/perfschema/r/binlog_row.result	2010-08-11 10:39:26 +0000
@@ -28,8 +28,8 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Update_rows	#	#	table_id: #
 master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table if exists test.t1
-master-bin.000001	#	Query	#	#	use `test`; drop table if exists test.t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table test.t1 (thread_id integer)
 master-bin.000001	#	Query	#	#	use `test`; create table test.t2 (name varchar(128))
 master-bin.000001	#	Query	#	#	BEGIN
@@ -40,8 +40,8 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t2)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table test.t1
-master-bin.000001	#	Query	#	#	use `test`; drop table test.t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (performance_schema.SETUP_INSTRUMENTS)
 master-bin.000001	#	Update_rows	#	#	table_id: #

=== modified file 'mysql-test/suite/perfschema/r/binlog_stmt.result'
--- a/mysql-test/suite/perfschema/r/binlog_stmt.result	2010-04-28 12:47:49 +0000
+++ b/mysql-test/suite/perfschema/r/binlog_stmt.result	2010-08-11 10:39:26 +0000
@@ -36,8 +36,8 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='NO'
   where name like "wait/synch/rwlock/%"
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table if exists test.t1
-master-bin.000001	#	Query	#	#	use `test`; drop table if exists test.t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table test.t1 (thread_id integer)
 master-bin.000001	#	Query	#	#	use `test`; create table test.t2 (name varchar(128))
 master-bin.000001	#	Query	#	#	BEGIN
@@ -49,8 +49,8 @@ master-bin.000001	#	Query	#	#	use `test`
 select name from performance_schema.SETUP_INSTRUMENTS
 where name like "wait/synch/rwlock/%"
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table test.t1
-master-bin.000001	#	Query	#	#	use `test`; drop table test.t2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t2` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; update performance_schema.SETUP_INSTRUMENTS set enabled='YES'
   where name like "wait/synch/rwlock/%"

=== modified file 'mysql-test/suite/rpl/r/rpl_conditional_comments.result'
--- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result	2010-07-29 03:24:35 +0000
+++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result	2010-08-11 10:39:26 +0000
@@ -43,7 +43,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(c1 INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO /* 99999 blabla*/ t1 VALUES(60) /* 99999 ,(61)*/
@@ -51,7 +51,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(c1 INT)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO /* 99999 blabla */ t1 VALUES(62) /* 99999 ,(63)*/

=== modified file 'mysql-test/suite/rpl/r/rpl_drop_if_exists.result'
--- a/mysql-test/suite/rpl/r/rpl_drop_if_exists.result	2009-08-29 08:52:22 +0000
+++ b/mysql-test/suite/rpl/r/rpl_drop_if_exists.result	2010-08-11 10:39:26 +0000
@@ -13,7 +13,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
 master-bin.000001	#	Query	#	#	use `test`; DROP VIEW IF EXISTS db_bug_13684.v
 master-bin.000001	#	Query	#	#	use `test`; DROP EVENT IF EXISTS db_bug_13684.e
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS db_bug_13684.t
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
 master-bin.000001	#	Query	#	#	DROP DATABASE IF EXISTS db_bug_13684
 CREATE DATABASE db_bug_13684;
 CREATE TABLE db_bug_13684.t (a int);
@@ -39,7 +39,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
 master-bin.000001	#	Query	#	#	use `test`; DROP VIEW IF EXISTS db_bug_13684.v
 master-bin.000001	#	Query	#	#	use `test`; DROP EVENT IF EXISTS db_bug_13684.e
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS db_bug_13684.t
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
 master-bin.000001	#	Query	#	#	DROP DATABASE IF EXISTS db_bug_13684
 master-bin.000001	#	Query	#	#	CREATE DATABASE db_bug_13684
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE db_bug_13684.t (a int)
@@ -71,7 +71,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
 master-bin.000001	#	Query	#	#	use `test`; DROP VIEW IF EXISTS db_bug_13684.v
 master-bin.000001	#	Query	#	#	use `test`; DROP EVENT IF EXISTS db_bug_13684.e
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS db_bug_13684.t
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
 master-bin.000001	#	Query	#	#	DROP DATABASE IF EXISTS db_bug_13684
 master-bin.000001	#	Query	#	#	CREATE DATABASE db_bug_13684
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE db_bug_13684.t (a int)
@@ -94,5 +94,5 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	use `test`; DROP TRIGGER IF EXISTS db_bug_13684.tr
 master-bin.000001	#	Query	#	#	use `test`; DROP VIEW IF EXISTS db_bug_13684.v
 master-bin.000001	#	Query	#	#	use `test`; DROP EVENT IF EXISTS db_bug_13684.e
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS db_bug_13684.t
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `db_bug_13684`.`t` /* generated by server */
 master-bin.000001	#	Query	#	#	DROP DATABASE IF EXISTS db_bug_13684

=== modified file 'mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result'
--- a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result	2010-06-30 19:37:41 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result	2010-08-11 10:39:26 +0000
@@ -57,14 +57,14 @@ SET @commands= 'Drop-Temp-T-Temp';
 DROP TEMPORARY TABLE tt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >>  << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >>  << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-N-Temp';
 DROP TEMPORARY TABLE nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-Xe-Temp';
@@ -80,7 +80,7 @@ Warnings:
 Note	1051	Unknown table 'tt_xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TXe-Temp';
@@ -88,7 +88,7 @@ DROP TEMPORARY TABLE tt_tmp_2, tt_1;
 ERROR 42S02: Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-If-TXe-Temp';
@@ -97,7 +97,7 @@ Warnings:
 Note	1051	Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-NXe-Temp';
@@ -105,7 +105,7 @@ DROP TEMPORARY TABLE nt_tmp_2, tt_1;
 ERROR 42S02: Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-If-NXe-Temp';
@@ -114,28 +114,30 @@ Warnings:
 Note	1051	Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TN-Temp';
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TT-Temp';
 DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-NN-Temp';
 DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -151,7 +153,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -169,8 +171,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -182,8 +184,10 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -197,12 +201,16 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -249,7 +257,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -271,8 +279,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -286,7 +294,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -306,8 +314,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -322,7 +330,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -344,8 +352,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -358,8 +366,10 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -375,12 +385,16 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -394,8 +408,11 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -413,12 +430,18 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -430,8 +453,11 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -440,18 +466,23 @@ BEGIN;
 INSERT INTO tt_xx_1() VALUES (1);
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
 COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -464,7 +495,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -481,7 +512,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -493,8 +524,10 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -507,11 +540,13 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -528,7 +563,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -548,8 +583,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -561,8 +596,10 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -578,12 +615,16 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -632,7 +673,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -656,8 +697,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -671,7 +712,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -693,8 +734,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -709,7 +750,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -733,8 +774,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -747,8 +788,10 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -766,12 +809,16 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -785,8 +832,11 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -806,12 +856,18 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -823,8 +879,11 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -833,20 +892,25 @@ BEGIN;
 INSERT INTO tt_xx_1() VALUES (1);
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -859,7 +923,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -878,7 +942,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -890,8 +954,10 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -906,11 +972,13 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -925,14 +993,14 @@ SET @commands= 'Drop-T';
 DROP TABLE tt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-N';
 DROP TABLE nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Xe';
@@ -948,7 +1016,7 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TXe';
@@ -956,7 +1024,7 @@ DROP TABLE tt_2, xx_1;
 ERROR 42S02: Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-If-TXe';
@@ -965,7 +1033,7 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-NXe';
@@ -973,7 +1041,7 @@ DROP TABLE nt_2, xx_1;
 ERROR 42S02: Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-If-NXe';
@@ -982,42 +1050,45 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TN';
 DROP TABLE tt_2, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TT';
 DROP TABLE tt_1, tt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-NN';
 DROP TABLE nt_1, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-N-TN-Temp';
 DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TN-Temp';
 DROP TABLE tt_tmp_2, nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -1033,7 +1104,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-N';
@@ -1045,7 +1116,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-Xe';
@@ -1071,7 +1142,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TXe';
@@ -1084,7 +1155,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-If-TXe';
@@ -1098,7 +1169,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-NXe';
@@ -1111,7 +1182,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-If-NXe';
@@ -1125,7 +1196,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TN';
@@ -1137,7 +1208,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TT';
@@ -1149,7 +1220,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-NN';
@@ -1161,7 +1232,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-N-TN-Temp';
@@ -1173,7 +1244,9 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TN-Temp';
@@ -1185,7 +1258,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 #########################################################################
@@ -1202,10 +1276,10 @@ DROP TEMPORARY TABLE nt_tmp_1;
 DROP TEMPORARY TABLE nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
@@ -1215,10 +1289,10 @@ DROP TEMPORARY TABLE tt_tmp_1;
 DROP TEMPORARY TABLE tt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -1236,11 +1310,19 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1254,10 +1336,10 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1276,11 +1358,19 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1294,10 +1384,10 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1347,8 +1437,8 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1362,16 +1452,8 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1385,14 +1467,8 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1413,16 +1489,12 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1438,15 +1510,9 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R';
@@ -1461,16 +1527,8 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1486,15 +1544,9 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################

=== modified file 'mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result'
--- a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result	2010-04-20 09:10:43 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result	2010-08-11 10:39:26 +0000
@@ -494,7 +494,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(ddl_case) VALUES (3)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-

=== modified file 'mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result	2010-06-30 15:25:13 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result	2010-08-11 10:39:26 +0000
@@ -10398,12 +10398,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10419,12 +10419,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10440,12 +10440,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM nt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10461,12 +10461,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10482,12 +10482,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10503,12 +10503,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -10689,11 +10689,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10863,11 +10863,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11061,11 +11061,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11267,11 +11267,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -11308,11 +11308,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_11;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11366,11 +11366,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_12;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11410,11 +11410,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_13;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11460,11 +11460,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_14;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11498,11 +11498,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_15;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11548,11 +11548,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_16;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################

=== modified file 'mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result	2010-06-30 15:25:13 +0000
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result	2010-08-11 10:39:26 +0000
@@ -10770,12 +10770,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10791,12 +10791,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10812,12 +10812,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM nt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10833,12 +10833,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10854,12 +10854,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10875,12 +10875,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -11061,11 +11061,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11235,11 +11235,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11433,11 +11433,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11639,11 +11639,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -11680,11 +11680,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_11;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11738,11 +11738,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_12;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11782,11 +11782,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_13;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11832,11 +11832,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_14;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11870,11 +11870,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_15;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11920,11 +11920,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_16;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################

=== modified file 'mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result	2010-05-07 09:37:16 +0000
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result	2010-08-11 10:39:26 +0000
@@ -12403,7 +12403,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12417,7 +12417,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12443,7 +12443,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12458,7 +12458,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Write_rows	#	#	table_id: #
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12484,7 +12484,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12499,7 +12499,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Write_rows	#	#	table_id: #
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12524,7 +12524,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12538,7 +12538,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_4)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12563,7 +12563,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12577,7 +12577,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_5)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12602,7 +12602,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12616,7 +12616,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_6)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -12827,11 +12827,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13031,11 +13031,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13261,11 +13261,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13499,11 +13499,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################

=== modified file 'mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result	2010-08-10 11:32:54 +0000
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result	2010-08-11 10:39:26 +0000
@@ -10012,12 +10012,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10033,12 +10033,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10054,12 +10054,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM nt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10075,12 +10075,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10096,12 +10096,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10117,12 +10117,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -10293,11 +10293,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10463,11 +10463,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10646,11 +10646,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10829,11 +10829,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -10870,11 +10870,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_11;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10928,11 +10928,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_12;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10972,11 +10972,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_13;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11022,11 +11022,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_14;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11060,11 +11060,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_15;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11110,11 +11110,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_16;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################

=== modified file 'mysql-test/suite/rpl/r/rpl_row_drop.result'
--- a/mysql-test/suite/rpl/r/rpl_row_drop.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_drop.result	2010-08-11 10:39:26 +0000
@@ -46,8 +46,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a int)
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 SHOW TABLES;
 Tables_in_test
 t2

=== modified file 'mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result'
--- a/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result	2010-06-30 19:37:41 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result	2010-08-11 10:39:26 +0000
@@ -80,6 +80,7 @@ Warnings:
 Note	1051	Unknown table 'tt_xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TXe-Temp';
@@ -96,7 +97,7 @@ Warnings:
 Note	1051	Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-NXe-Temp';
@@ -114,13 +115,15 @@ Note	1051	Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TN-Temp';
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TT-Temp';
@@ -184,9 +187,11 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -200,14 +205,18 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -258,6 +267,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -281,6 +291,8 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -334,7 +346,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -358,8 +370,8 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -372,9 +384,11 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -390,14 +404,18 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -411,9 +429,12 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -431,14 +452,20 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -450,9 +477,12 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -461,20 +491,25 @@ BEGIN;
 INSERT INTO tt_xx_1() VALUES (1);
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
 COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -519,9 +554,11 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -534,13 +571,15 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -593,9 +632,11 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -611,14 +652,18 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -671,6 +716,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -696,6 +742,8 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -751,7 +799,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -777,8 +825,8 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -791,9 +839,11 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -811,14 +861,18 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -832,9 +886,12 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -854,14 +911,20 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -873,9 +936,12 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -884,22 +950,27 @@ BEGIN;
 INSERT INTO tt_xx_1() VALUES (1);
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -946,9 +1017,11 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -963,13 +1036,15 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1`,`nt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -984,14 +1059,14 @@ SET @commands= 'Drop-T';
 DROP TABLE tt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-N';
 DROP TABLE nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Xe';
@@ -1007,7 +1082,7 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TXe';
@@ -1015,7 +1090,7 @@ DROP TABLE tt_2, xx_1;
 ERROR 42S02: Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-If-TXe';
@@ -1024,7 +1099,7 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-NXe';
@@ -1032,7 +1107,7 @@ DROP TABLE nt_2, xx_1;
 ERROR 42S02: Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-If-NXe';
@@ -1041,43 +1116,45 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TN';
 DROP TABLE tt_2, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TT';
 DROP TABLE tt_1, tt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-NN';
 DROP TABLE nt_1, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-N-TN-Temp';
 DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TN-Temp';
 DROP TABLE tt_tmp_2, nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -1094,7 +1171,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-N';
@@ -1107,7 +1184,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-Xe';
@@ -1135,7 +1212,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TXe';
@@ -1149,7 +1226,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-If-TXe';
@@ -1164,7 +1241,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-NXe';
@@ -1178,7 +1255,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-If-NXe';
@@ -1193,7 +1270,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TN';
@@ -1206,7 +1283,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TT';
@@ -1219,7 +1296,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-NN';
@@ -1232,7 +1309,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-N-TN-Temp';
@@ -1245,8 +1322,9 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TN-Temp';
@@ -1259,7 +1337,8 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 #########################################################################
@@ -1308,11 +1387,17 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1347,11 +1432,17 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 

=== modified file 'mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result'
--- a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result	2010-07-27 10:25:53 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result	2010-08-11 10:39:26 +0000
@@ -530,7 +530,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-

=== modified file 'mysql-test/suite/rpl/r/rpl_row_log.result'
--- a/mysql-test/suite/rpl/r/rpl_row_log.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result	2010-08-11 10:39:26 +0000
@@ -23,7 +23,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
@@ -198,7 +198,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
@@ -228,7 +228,7 @@ slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	use `test`; drop table t1
+slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 slave-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)

=== modified file 'mysql-test/suite/rpl/r/rpl_row_log_innodb.result'
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result	2010-08-11 10:39:26 +0000
@@ -23,7 +23,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
@@ -198,7 +198,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
@@ -228,7 +228,7 @@ slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 slave-bin.000001	#	Xid	#	#	COMMIT /* XID */
-slave-bin.000001	#	Query	#	#	use `test`; drop table t1
+slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 slave-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)

=== modified file 'mysql-test/suite/rpl/r/rpl_row_mixing_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result	2010-05-07 09:37:16 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_mixing_engines.result	2010-08-11 10:39:26 +0000
@@ -12403,7 +12403,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12417,7 +12417,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_xx_1)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12443,7 +12443,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12458,7 +12458,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Write_rows	#	#	table_id: #
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12484,7 +12484,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12499,7 +12499,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Write_rows	#	#	table_id: #
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12524,7 +12524,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12538,7 +12538,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_4)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12563,7 +12563,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12577,7 +12577,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_5)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -12602,7 +12602,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -12616,7 +12616,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_xx_6)
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -12827,11 +12827,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13031,11 +13031,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13261,11 +13261,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -13499,11 +13499,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################

=== modified file 'mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result'
--- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result	2010-01-30 21:29:13 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result	2010-08-11 10:39:26 +0000
@@ -188,7 +188,7 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-DROP TABLE IF EXISTS t1,t2,t3
+DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 CREATE TABLE t1(word VARCHAR(20))
@@ -297,7 +297,7 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-DROP TABLE IF EXISTS t1,t2,t3
+DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
 /*!*/;
 SET TIMESTAMP=1000000000/*!*/;
 CREATE TABLE t1(word VARCHAR(20))

=== modified file 'mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result'
--- a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result	2010-08-11 10:39:26 +0000
@@ -201,7 +201,7 @@ DROP TABLE t1;
 [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
 show binlog events in 'master-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Query	#	#	use `test`; DROP TABLE t1
+master-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 [MASTER] ********* SOW BINLOG EVENTS         *********
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -234,7 +234,7 @@ master-bin.000001	#	Rotate	#	#	master-bi
 [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
 show binlog events in 'slave-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000002	#	Query	#	#	use `test`; DROP TABLE t1
+slave-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 [SLAVE] ********* SOW BINLOG EVENTS          *********
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info

=== modified file 'mysql-test/suite/rpl/r/rpl_server_id.result'
--- a/mysql-test/suite/rpl/r/rpl_server_id.result	2007-12-24 07:03:23 +0000
+++ b/mysql-test/suite/rpl/r/rpl_server_id.result	2010-08-11 10:39:26 +0000
@@ -7,7 +7,7 @@ select @@server_id;
 1
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; drop table if exists t1,t2,t3
+master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
 set global server_id=2;
 create table t2 (b int);
@@ -16,7 +16,7 @@ select @@server_id;
 2
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; drop table if exists t1,t2,t3
+master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	2	#	use `test`; create table t2 (b int)
 set global server_id=3;
@@ -26,7 +26,7 @@ select @@server_id;
 3
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; drop table if exists t1,t2,t3
+master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
 master-bin.000001	#	Query	1	#	use `test`; create table t1 (a int)
 master-bin.000001	#	Query	2	#	use `test`; create table t2 (b int)
 master-bin.000001	#	Query	3	#	use `test`; create table t3 (c int)

=== modified file 'mysql-test/suite/rpl/r/rpl_sp.result'
--- a/mysql-test/suite/rpl/r/rpl_sp.result	2010-06-17 13:31:51 +0000
+++ b/mysql-test/suite/rpl/r/rpl_sp.result	2010-08-11 10:39:26 +0000
@@ -430,7 +430,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`()
 select * from mysqltest1.t1
 master-bin.000001	#	Query	#	#	use `mysqltest1`; alter procedure foo2 contains sql
-master-bin.000001	#	Query	#	#	use `mysqltest1`; drop table t1
+master-bin.000001	#	Query	#	#	use `mysqltest1`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `mysqltest1`; create table t1 (a int)
 master-bin.000001	#	Query	#	#	use `mysqltest1`; create table t2 like t1
 master-bin.000001	#	Query	#	#	use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`()
@@ -571,7 +571,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; drop view v1
 master-bin.000001	#	Query	#	#	use `test`; drop function f1
 master-bin.000001	#	Query	#	#	use `test`; DROP PROCEDURE IF EXISTS p1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1(col VARCHAR(10))
 master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10))
 INSERT INTO t1 VALUES(arg)
@@ -587,7 +587,7 @@ master-bin.000001	#	Query	#	#	use `test`
 RETURN 0
 master-bin.000001	#	Query	#	#	use `test`; DROP PROCEDURE p1
 master-bin.000001	#	Query	#	#	use `test`; DROP FUNCTION f1
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	drop database if exists mysqltest
 master-bin.000001	#	Query	#	#	drop database if exists mysqltest2
 master-bin.000001	#	Query	#	#	create database mysqltest
@@ -722,7 +722,7 @@ SET TIMESTAMP=t/*!*/;
 alter procedure foo2 contains sql
 /*!*/;
 SET TIMESTAMP=t/*!*/;
-drop table t1
+DROP TABLE `t1` /* generated by server */
 /*!*/;
 SET TIMESTAMP=t/*!*/;
 create table t1 (a int)
@@ -1060,7 +1060,7 @@ SET TIMESTAMP=t/*!*/;
 DROP PROCEDURE IF EXISTS p1
 /*!*/;
 SET TIMESTAMP=t/*!*/;
-DROP TABLE IF EXISTS t1
+DROP TABLE IF EXISTS `t1` /* generated by server */
 /*!*/;
 SET TIMESTAMP=t/*!*/;
 CREATE TABLE t1(col VARCHAR(10))
@@ -1102,7 +1102,7 @@ SET TIMESTAMP=t/*!*/;
 DROP FUNCTION f1
 /*!*/;
 SET TIMESTAMP=t/*!*/;
-drop table t1
+DROP TABLE `t1` /* generated by server */
 /*!*/;
 SET TIMESTAMP=t/*!*/;
 drop database if exists mysqltest

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result	2010-06-30 19:37:41 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result	2010-08-11 10:39:26 +0000
@@ -57,14 +57,14 @@ SET @commands= 'Drop-Temp-T-Temp';
 DROP TEMPORARY TABLE tt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >>  << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >>  << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-N-Temp';
 DROP TEMPORARY TABLE nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-Xe-Temp';
@@ -80,7 +80,7 @@ Warnings:
 Note	1051	Unknown table 'tt_xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TXe-Temp';
@@ -88,7 +88,7 @@ DROP TEMPORARY TABLE tt_tmp_2, tt_1;
 ERROR 42S02: Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-If-TXe-Temp';
@@ -97,7 +97,7 @@ Warnings:
 Note	1051	Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-NXe-Temp';
@@ -105,7 +105,7 @@ DROP TEMPORARY TABLE nt_tmp_2, tt_1;
 ERROR 42S02: Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-If-NXe-Temp';
@@ -114,28 +114,30 @@ Warnings:
 Note	1051	Unknown table 'tt_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TN-Temp';
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-TT-Temp';
 DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-TT-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-TT-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-NN-Temp';
 DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-NN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-NN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -151,7 +153,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -169,8 +171,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -182,8 +184,10 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -197,12 +201,16 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -249,7 +257,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -271,8 +279,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -286,7 +294,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -306,8 +314,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -322,7 +330,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -344,8 +352,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -358,8 +366,10 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -375,12 +385,16 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -394,8 +408,11 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -413,12 +430,18 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -430,8 +453,11 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -440,18 +466,23 @@ BEGIN;
 INSERT INTO tt_xx_1() VALUES (1);
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
 COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -464,7 +495,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -481,7 +512,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -493,8 +524,10 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -507,11 +540,13 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -528,7 +563,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -548,8 +583,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -561,8 +596,10 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -578,12 +615,16 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -632,7 +673,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -656,8 +697,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -671,7 +712,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -693,8 +734,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -709,7 +750,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -733,8 +774,8 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_2`,`tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_tmp_1`,`tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -747,8 +788,10 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -766,12 +809,16 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, tt_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -785,8 +832,11 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -806,12 +856,18 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -823,8 +879,11 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -833,20 +892,25 @@ BEGIN;
 INSERT INTO tt_xx_1() VALUES (1);
 DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
 INSERT INTO nt_xx_1() VALUES (1);
-DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
-ERROR 42S02: Unknown table 'nt_tmp_2'
+DROP TEMPORARY TABLE tt_tmp_1, nt_tmp_1;
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -859,7 +923,7 @@ ROLLBACK;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -878,7 +942,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1`,`tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -890,8 +954,10 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -906,11 +972,13 @@ Warning	1196	Some non-transactional chan
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1`,`nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -925,14 +993,14 @@ SET @commands= 'Drop-T';
 DROP TABLE tt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-T << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-N';
 DROP TABLE nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-N << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Xe';
@@ -948,7 +1016,7 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-Xe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TXe';
@@ -956,7 +1024,7 @@ DROP TABLE tt_2, xx_1;
 ERROR 42S02: Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-If-TXe';
@@ -965,7 +1033,7 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-TXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-NXe';
@@ -973,7 +1041,7 @@ DROP TABLE nt_2, xx_1;
 ERROR 42S02: Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-NXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-If-NXe';
@@ -982,42 +1050,45 @@ Warnings:
 Note	1051	Unknown table 'xx_1'
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-If-NXe << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TN';
 DROP TABLE tt_2, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TT';
 DROP TABLE tt_1, tt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-NN';
 DROP TABLE nt_1, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-NN << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-N-TN-Temp';
 DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-N-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-TN-Temp';
 DROP TABLE tt_tmp_2, nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-TN-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -1033,7 +1104,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-T << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-N';
@@ -1045,7 +1116,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-Xe';
@@ -1071,7 +1142,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-Xe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TXe';
@@ -1084,7 +1155,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-If-TXe';
@@ -1098,7 +1169,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-TXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-NXe';
@@ -1111,7 +1182,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-If-NXe';
@@ -1125,7 +1196,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS nt_2, xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `nt_2`,`xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-If-NXe << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TN';
@@ -1137,7 +1208,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_2`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TT';
@@ -1149,7 +1220,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_1, tt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `tt_1`,`tt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TT << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-NN';
@@ -1161,7 +1232,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE nt_1, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_1`,`nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-NN << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-N-TN-Temp';
@@ -1173,7 +1244,9 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_tmp_2, nt_tmp_2, nt_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `nt_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-N-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'B T Drop-TN-Temp';
@@ -1185,7 +1258,8 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE tt_tmp_2, nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-TN-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 #########################################################################
@@ -1202,10 +1276,10 @@ DROP TEMPORARY TABLE nt_tmp_1;
 DROP TEMPORARY TABLE nt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
@@ -1215,10 +1289,10 @@ DROP TEMPORARY TABLE tt_tmp_1;
 DROP TEMPORARY TABLE tt_tmp_2;
 -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -1236,11 +1310,19 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1254,10 +1336,10 @@ COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1276,11 +1358,19 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE nt_tmp_2
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `nt_tmp_2` /* generated by server */
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1294,10 +1384,10 @@ ROLLBACK;
 -b-b-b-b-b-b-b-b-b-b-b- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_1` /* generated by server */
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE `tt_tmp_2` /* generated by server */
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1336,6 +1426,8 @@ BEGIN;
 INSERT INTO nt_xx_1() VALUES (1);
 INSERT INTO nt_tmp_xx_1() VALUES (1);
 INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
 INSERT INTO nt_tmp_xx_1() VALUES (1);
 COMMIT;
 -b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -b-b-b-b-b-b-b-b-b-b-b-
@@ -1347,8 +1439,10 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1391,9 +1485,11 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
+master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -1431,6 +1527,8 @@ BEGIN;
 INSERT INTO nt_xx_1() VALUES (1);
 INSERT INTO nt_tmp_xx_1() VALUES (1);
 INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+Warnings:
+Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
 INSERT INTO nt_tmp_xx_1() VALUES (1);
 ROLLBACK;
 Warnings:
@@ -1444,8 +1542,10 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-N-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -1492,8 +1592,10 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp T-SELECT-T-Temp N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
 

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result	2010-04-20 09:10:43 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result	2010-08-11 10:39:26 +0000
@@ -430,7 +430,7 @@ DROP TEMPORARY TABLE IF EXISTS new_tt_xx
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(ddl_case) VALUES (8)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS new_tt_xx
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `new_tt_xx` /* generated by server */
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -493,7 +493,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(ddl_case) VALUES (3)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_log.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result	2010-08-11 10:39:26 +0000
@@ -23,7 +23,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=1
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
@@ -198,7 +198,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Intvar	#	#	INSERT_ID=1
 master-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
 master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	use `test`; drop table t1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#
@@ -227,7 +227,7 @@ slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Intvar	#	#	INSERT_ID=1
 slave-bin.000001	#	Query	#	#	use `test`; insert into t1 values (NULL)
 slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	use `test`; drop table t1
+slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 slave-bin.000001	#	Query	#	#	use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Begin_load_query	#	#	;file_id=#;block_len=#

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result	2010-08-11 10:39:26 +0000
@@ -171,7 +171,7 @@ DROP TABLE t1;
 [MASTER] ********* SOW BINLOG EVENTS IN ...  *********
 show binlog events in 'master-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000002	#	Query	#	#	use `test`; DROP TABLE t1
+master-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 [MASTER] ********* SOW BINLOG EVENTS         *********
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -198,7 +198,7 @@ master-bin.000001	#	Rotate	#	#	master-bi
 [SLAVE] ********* SOW BINLOG EVENTS IN ...   *********
 show binlog events in 'slave-bin.000002' from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000002	#	Query	#	#	use `test`; DROP TABLE t1
+slave-bin.000002	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 [SLAVE] ********* SOW BINLOG EVENTS          *********
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result	2010-06-30 15:25:13 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result	2010-08-11 10:39:26 +0000
@@ -7092,24 +7092,20 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
 COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (233, 2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> B T tN C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (233, 2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 233, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T tN C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -7345,24 +7341,20 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1;
 Got one of the listed errors
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> C << -b-b-b-b-b-b-b-b-b-b-b-
 COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (241, 2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> B T tNe C << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (241, 2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 241, 4, COUNT(*) FROM tt_1 UNION SELECT 233, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> B T tNe C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -7532,9 +7524,6 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> tN << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
 ROLLBACK;
@@ -7543,15 +7532,14 @@ Warning	1196	Some non-transactional chan
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (247, 2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> B T tN R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (247, 2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 247, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T tN R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -7791,9 +7779,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1;
 Got one of the listed errors
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> tNe << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
 ROLLBACK;
@@ -7802,15 +7787,14 @@ Warning	1196	Some non-transactional chan
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (255, 2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> B T tNe R << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (255, 2)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 255, 4, COUNT(*) FROM tt_1 UNION SELECT 247, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> B T tNe R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -10164,12 +10148,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_1, nt_xx_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->T CS-T->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tt_xx_1 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_1, nt_xx_1
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_1`,`nt_xx_1` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->T CS-T->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10185,12 +10169,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_2, nt_xx_2;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->N CS-N->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_2 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_2, nt_xx_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_2`,`nt_xx_2` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->N CS-N->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10206,12 +10190,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_3, nt_xx_3;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-T->N CS-T->N drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE tt_xx_3 (PRIMARY KEY(trans_id, stmt_id)) engine=Innodb SELECT * FROM nt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_3, nt_xx_3
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_3`,`nt_xx_3` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-T->N CS-T->N drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10227,12 +10211,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_4, nt_xx_4;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_4 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_4, nt_xx_4
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_4`,`nt_xx_4` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10248,12 +10232,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_5, nt_xx_5;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_5 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_5, nt_xx_5
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_5`,`nt_xx_5` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10269,12 +10253,12 @@ master-bin.000001	#	Query	#	#	use `test`
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_6, nt_xx_6;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> CSe-N->T CS-N->T drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE nt_xx_6 (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_6, nt_xx_6
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_6`,`nt_xx_6` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> CSe-N->T CS-N->T drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -10445,11 +10429,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_7, nt_xx_7;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_7, nt_xx_7
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_7`,`nt_xx_7` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-T->T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10615,11 +10599,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_8, nt_xx_8;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_8, nt_xx_8
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_8`,`nt_xx_8` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10651,9 +10635,6 @@ Warnings:
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
 Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> IS-N<-T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 6);
@@ -10664,6 +10645,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 3)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 6)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10671,10 +10653,8 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; TRUNCATE TABLE nt_xx_9
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 3)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (340, 6)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> trunc-CS-N B T IS-N<-T T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10696,9 +10676,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1;;
 Got one of the listed errors
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> ISe-N<-T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 6);
@@ -10709,6 +10686,7 @@ COMMIT;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 3)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 6)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10716,10 +10694,8 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	use `test`; TRUNCATE TABLE nt_xx_9
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 3)
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id) VALUES (341, 6)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> trunc-CS-N B T ISe-N<-T T C << -e-e-e-e-e-e-e-e-e-e-e-
@@ -10806,11 +10782,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_9, nt_xx_9;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_9, nt_xx_9
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_9`,`nt_xx_9` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> CS-N->N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10996,11 +10972,11 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TABLE IF EXISTS tt_xx_10, nt_xx_10;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CS << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx_10, nt_xx_10
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx_10`,`nt_xx_10` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CS << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################
@@ -11037,11 +11013,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_11;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_11
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_11` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11095,11 +11071,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_12;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_12
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_12` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11139,11 +11115,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_13;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_13
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_13` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11189,11 +11165,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_14;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_14
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_14` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11227,11 +11203,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_15;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_15
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_15` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> B << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11277,11 +11253,11 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 DROP TEMPORARY TABLE IF EXISTS tt_xx_16;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS tt_xx_16
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt_xx_16` /* generated by server */
 -e-e-e-e-e-e-e-e-e-e-e- >> drop-CT << -e-e-e-e-e-e-e-e-e-e-e-
 
 ###################################################################################

=== modified file 'mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result'
--- a/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result	2010-08-11 10:39:26 +0000
@@ -60,8 +60,8 @@ slave-bin.000001	#	Query	#	#	use `test`;
 slave-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES ()
 slave-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE t1_tmp (i1 int)
 slave-bin.000001	#	Query	#	#	use `test`; ALTER TABLE t1_tmp ADD COLUMN b INT
-slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t2` /* generated by server */
 slave-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t1_tmp` /* generated by server */
+slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t2` /* generated by server */
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
 slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
@@ -70,4 +70,4 @@ slave-bin.000001	#	Query	#	#	use `test`;
 slave-bin.000001	#	Query	#	#	BEGIN
 slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (2)
 slave-bin.000001	#	Query	#	#	COMMIT
-slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE t3, t1
+slave-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t3`,`t1` /* generated by server */

=== removed file 'mysql-test/suite/rpl/t/rpl_mixed_row_innodb.test'
--- a/mysql-test/suite/rpl/t/rpl_mixed_row_innodb.test	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mixed_row_innodb.test	1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-# File for specialities regarding replication from or to InnoDB
-# tables.
-
-source include/master-slave.inc;
-source include/have_innodb.inc;
-source include/have_binlog_format_mixed_or_row.inc;
-
-source extra/rpl_tests/rpl_innodb.test;

=== modified file 'mysql-test/suite/rpl/t/rpl_stm_innodb.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_innodb.test	2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_innodb.test	2010-08-11 10:39:26 +0000
@@ -3,6 +3,6 @@
 
 source include/master-slave.inc;
 source include/have_innodb.inc;
-source include/have_binlog_format_statement.inc;
+source include/have_binlog_format_mixed_or_statement.inc;
 
 source extra/rpl_tests/rpl_innodb.test;

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result	2007-06-27 12:29:10 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result	2010-08-11 10:39:26 +0000
@@ -34,7 +34,7 @@ pk1	b	c
 1	2	3
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001	#	Query	1	#	use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
 master-bin.000001	#	Query	1	#	use `test`; CREATE LOGFILE GROUP lg1
 ADD UNDOFILE 'undofile.dat'
 INITIAL_SIZE 16M

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result	2009-11-13 00:17:10 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_implicit_commit_binlog.result	2010-08-11 10:39:26 +0000
@@ -609,7 +609,7 @@ Note	1051	Unknown table 'tt_xx'
 -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_1)
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result	2010-04-20 09:10:43 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_implicit_commit_binlog.result	2010-08-11 10:39:26 +0000
@@ -610,7 +610,7 @@ Note	1051	Unknown table 'tt_xx'
 -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS tt_xx, new_tt_xx
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS `tt_xx`,`new_tt_xx` /* generated by server */
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_1)
 master-bin.000001	#	Table_map	#	#	table_id: # (mysql.ndb_apply_status)

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-08-10 11:32:54 +0000
+++ b/sql/log.cc	2010-08-11 10:39:26 +0000
@@ -4272,7 +4272,7 @@ bool use_trans_cache(const THD* thd, boo
     (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
 
   return
-    ((thd->variables.binlog_format != BINLOG_FORMAT_STMT ||
+    ((thd->is_current_stmt_binlog_format_row() ||
      thd->variables.binlog_direct_non_trans_update) ? is_transactional :
      (is_transactional || !cache_mngr->trx_cache.empty()));
 }

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2010-08-10 11:32:54 +0000
+++ b/sql/log_event.cc	2010-08-11 10:39:26 +0000
@@ -678,11 +678,11 @@ Log_event::Log_event(THD* thd_arg, uint1
 {
   server_id=	thd->server_id;
   when=		thd->start_time;
-  cache_type= ((using_trans || stmt_has_updated_trans_table(thd) ||
-               (thd->lex->stmt_accessed_temp_table() &&
-               trans_has_updated_trans_table(thd)))
-               ? Log_event::EVENT_TRANSACTIONAL_CACHE :
-               Log_event::EVENT_STMT_CACHE);
+
+  if (using_trans)
+    cache_type= Log_event::EVENT_TRANSACTIONAL_CACHE;
+  else
+    cache_type= Log_event::EVENT_STMT_CACHE;
 }
 
 /**
@@ -2520,21 +2520,18 @@ Query_log_event::Query_log_event(THD* th
 
   LEX *lex= thd->lex;
   /*
-    TRUE defines that either a trx-cache or stmt-cache must be used
-    and wrapped by a BEGIN...COMMIT. Otherwise, the statement will
-    be written directly to the binary log without being wrapped by
-    a BEGIN...COMMIT.
+    Defines that the statement will be written directly to the binary log
+    without being wrapped by a BEGIN...COMMIT. Otherwise, the statement
+    will be written to either the trx-cache or stmt-cache.
 
-    Note that a cache will not be used if the parameter direct is
-    TRUE.
+    Note that a cache will not be used if the parameter direct is TRUE.
   */
   bool use_cache= FALSE;
   /*
-    TRUE defines that the trx-cache must be used and by consequence
-    the use_cache is TRUE.
+    TRUE defines that the trx-cache must be used and by consequence the
+    use_cache is TRUE.
 
-    Note that a cache will not be used if the parameter direct is
-    TRUE.
+    Note that a cache will not be used if the parameter direct is TRUE.
   */
   bool trx_cache= FALSE;
   cache_type= Log_event::EVENT_INVALID_CACHE;
@@ -2542,16 +2539,14 @@ Query_log_event::Query_log_event(THD* th
   switch (lex->sql_command)
   {
     case SQLCOM_DROP_TABLE:
-      use_cache= trx_cache= (lex->drop_temporary &&
-                            thd->in_multi_stmt_transaction_mode());
+      use_cache= (lex->drop_temporary && thd->in_multi_stmt_transaction_mode());
     break;
 
     case SQLCOM_CREATE_TABLE:
-      use_cache= trx_cache=
-                 ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
-                   thd->in_multi_stmt_transaction_mode()) ||
-                 (lex->select_lex.item_list.elements &&
+      trx_cache= (lex->select_lex.item_list.elements &&
                   thd->is_current_stmt_binlog_format_row());
+      use_cache= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
+                   thd->in_multi_stmt_transaction_mode()) || trx_cache;
       break;
     case SQLCOM_SET_OPTION:
       use_cache= trx_cache= (lex->autocommit ? FALSE : TRUE);
@@ -2570,14 +2565,14 @@ Query_log_event::Query_log_event(THD* th
   {
     cache_type= Log_event::EVENT_NO_CACHE;
   }
+  else if (using_trans || trx_cache || stmt_has_updated_trans_table(thd) ||
+           thd->lex->is_mixed_stmt_unsafe(thd->in_multi_stmt_transaction_mode(),
+                                          thd->variables.binlog_direct_non_trans_update,
+                                          trans_has_updated_trans_table(thd),
+                                          thd->tx_isolation))
+    cache_type= Log_event::EVENT_TRANSACTIONAL_CACHE;
   else
-  {
-    cache_type= ((using_trans || stmt_has_updated_trans_table(thd) || trx_cache ||
-                 (thd->lex->stmt_accessed_temp_table() &&
-                 trans_has_updated_trans_table(thd)))
-                 ? Log_event::EVENT_TRANSACTIONAL_CACHE :
-                 Log_event::EVENT_STMT_CACHE);
-  }
+    cache_type= Log_event::EVENT_STMT_CACHE;
   DBUG_ASSERT(cache_type != Log_event::EVENT_INVALID_CACHE);
   DBUG_PRINT("info",("Query_log_event has flags2: %lu  sql_mode: %lu",
                      (ulong) flags2, sql_mode));

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-07-29 12:32:11 +0000
+++ b/sql/mysqld.cc	2010-08-11 10:39:26 +0000
@@ -4513,6 +4513,8 @@ int mysqld_main(int argc, char **argv)
   init_status_vars();
   if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
     opt_skip_slave_start= 1;
+
+  binlog_unsafe_map_init();
   /*
     init_slave() must be called after the thread keys are created.
     Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-07-29 12:32:11 +0000
+++ b/sql/sql_base.cc	2010-08-11 10:39:26 +0000
@@ -2042,13 +2042,17 @@ TABLE *find_temporary_table(THD *thd, TA
   thd->temporary_tables list, it's impossible to tell here whether
   we're dealing with an internal or a user temporary table.
 
+  If is_trans is not null, we return the type of the table:
+  either transactional (e.g. innodb) as TRUE or non-transactional
+  (e.g. myisam) as FALSE.
+
   @retval  0  the table was found and dropped successfully.
   @retval  1  the table was not found in the list of temporary tables
               of this thread
   @retval -1  the table is in use by a outer query
 */
 
-int drop_temporary_table(THD *thd, TABLE_LIST *table_list)
+int drop_temporary_table(THD *thd, TABLE_LIST *table_list, bool *is_trans)
 {
   TABLE *table;
   DBUG_ENTER("drop_temporary_table");
@@ -2065,6 +2069,9 @@ int drop_temporary_table(THD *thd, TABLE
     DBUG_RETURN(-1);
   }
 
+  if (is_trans != NULL)
+    *is_trans= table->file->has_transactions();
+
   /*
     If LOCK TABLES list is not empty and contains this table,
     unlock the table and remove the table from this list.

=== modified file 'sql/sql_base.h'
--- a/sql/sql_base.h	2010-07-29 10:18:13 +0000
+++ b/sql/sql_base.h	2010-08-11 10:39:26 +0000
@@ -226,7 +226,7 @@ bool close_thread_table(THD *thd, TABLE 
 bool close_temporary_tables(THD *thd);
 TABLE_LIST *unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
                          bool check_alias);
-int drop_temporary_table(THD *thd, TABLE_LIST *table_list);
+int drop_temporary_table(THD *thd, TABLE_LIST *table_list, bool *is_trans);
 void close_temporary_table(THD *thd, TABLE *table, bool free_share,
                            bool delete_table);
 void close_temporary(TABLE *table, bool free_share, bool delete_table);

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-08-10 11:32:54 +0000
+++ b/sql/sql_class.cc	2010-08-11 10:39:26 +0000
@@ -3770,124 +3770,16 @@ int THD::decide_logging_format(TABLE_LIS
     int error= 0;
     int unsafe_flags;
 
-    /*
-      Classify a statement as unsafe when there is a mixed statement and an
-      on-going transaction at any point of the execution if:
-
-        1. The mixed statement is about to update a transactional table and
-        a non-transactional table.
-
-        2. The mixed statement is about to update a temporary transactional
-        table and a non-transactional table.
-      
-        3. The mixed statement is about to update a transactional table and
-        read from a non-transactional table.
-
-        4. The mixed statement is about to update a temporary transactional
-        table and read from a non-transactional table.
-
-        5. The mixed statement is about to update a non-transactional table
-        and read from a transactional table when the isolation level is
-        lower than repeatable read.
-
-      After updating a transactional table if:
-
-        6. The mixed statement is about to update a non-transactional table
-        and read from a temporary transactional table.
- 
-        7. The mixed statement is about to update a non-transactional table
-        and read from a temporary transactional table.
-
-        8. The mixed statement is about to update a non-transactionala table
-        and read from a temporary non-transactional table.
-     
-        9. The mixed statement is about to update a temporary non-transactional
-        table and update a non-transactional table.
-     
-        10. The mixed statement is about to update a temporary non-transactional
-        table and read from a non-transactional table.
-     
-        11. A statement is about to update a non-transactional table and the
-        option variables.binlog_direct_non_trans_update is OFF.
-
-      The reason for this is that locks acquired may not protected a concurrent
-      transaction of interfering in the current execution and by consequence in
-      the result. In particular, if there is an on-going transaction and a
-      transactional table was already updated, a temporary table must be written
-      to the binary log in the boundaries of the on-going transaction and as
-      such we artificially classify them as transactional.
-    */
-    if (in_multi_stmt_transaction_mode())
-    {
-      my_bool mixed_unsafe= FALSE;
-      my_bool non_trans_unsafe= FALSE;
-
-      /* Case 1. */
-      if (lex->stmt_accessed_table(LEX::STMT_WRITES_TRANS_TABLE) &&
-          lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
-        mixed_unsafe= TRUE;
-      /* Case 2. */
-      else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_TRANS_TABLE) &&
-               lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
-        mixed_unsafe= TRUE;
-      /* Case 3. */
-      else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TRANS_TABLE) &&
-               lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
-        mixed_unsafe= TRUE;
-      /* Case 4. */
-      else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_TRANS_TABLE) &&
-               lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
-        mixed_unsafe= TRUE;
-      /* Case 5. */
-      else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
-               lex->stmt_accessed_table(LEX::STMT_READS_TRANS_TABLE) &&
-               tx_isolation < ISO_REPEATABLE_READ)
-        /*
-           By default, InnoDB operates in REPEATABLE READ and with the option
-           --innodb-locks-unsafe-for-binlog disabled. In this case, InnoDB uses
-           next-key locks for searches and index scans, which prevents phantom
-           rows.
- 
-           This is scenario is safe for Innodb. However, there are no means to
-           transparently get this information. Therefore, we need to improve this
-           and change the storage engines to report somehow when an execution is
-           safe under an isolation level & binary logging format.
-        */
-        mixed_unsafe= TRUE;
-
-      if (trans_has_updated_trans_table(this))
-      {
-        /* Case 6. */
-        if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
-            lex->stmt_accessed_table(LEX::STMT_READS_TRANS_TABLE))
-          mixed_unsafe= TRUE;
-        /* Case 7. */
-        else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
-                 lex->stmt_accessed_table(LEX::STMT_READS_TEMP_TRANS_TABLE))
-          mixed_unsafe= TRUE;
-        /* Case 8. */
-        else if (lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE) &&
-                 lex->stmt_accessed_table(LEX::STMT_READS_TEMP_NON_TRANS_TABLE))
-          mixed_unsafe= TRUE;
-        /* Case 9. */
-        else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
-                 lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
-          mixed_unsafe= TRUE;
-        /* Case 10. */
-        else if (lex->stmt_accessed_table(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
-                 lex->stmt_accessed_table(LEX::STMT_READS_NON_TRANS_TABLE))
-        mixed_unsafe= TRUE;
-        /* Case 11. */
-        else if (!variables.binlog_direct_non_trans_update &&
-                 lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
-          non_trans_unsafe= TRUE;
-      }
-
-      if (mixed_unsafe)
-        lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MIXED_STATEMENT);
-      else if (non_trans_unsafe)
-        lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS);
-    }
+    bool multi_stmt_trans= in_multi_stmt_transaction_mode();
+    bool trans_table= trans_has_updated_trans_table(this);
+    bool binlog_direct= variables.binlog_direct_non_trans_update;
+
+    if (lex->is_mixed_stmt_unsafe(multi_stmt_trans, binlog_direct,
+                                  trans_table, tx_isolation))
+      lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_MIXED_STATEMENT);
+    else if (multi_stmt_trans && trans_table && !binlog_direct &&
+             lex->stmt_accessed_table(LEX::STMT_WRITES_NON_TRANS_TABLE))
+      lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_NONTRANS_AFTER_TRANS);
 
     /*
       If more than one engine is involved in the statement and at

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2010-07-30 15:13:38 +0000
+++ b/sql/sql_insert.cc	2010-08-11 10:39:26 +0000
@@ -3576,7 +3576,7 @@ static TABLE *create_table_from_items(TH
     if (!mysql_create_table_no_lock(thd, create_table->db,
                                     create_table->table_name,
                                     create_info, alter_info, 0,
-                                    select_field_count))
+                                    select_field_count, NULL))
     {
       if (create_info->table_existed)
       {
@@ -3619,7 +3619,7 @@ static TABLE *create_table_from_items(TH
             it preparable for open. But let us do close_temporary_table() here
             just in case.
           */
-          drop_temporary_table(thd, create_table);
+          drop_temporary_table(thd, create_table, NULL);
         }
         else
           table= create_table->table;

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2010-08-10 11:32:54 +0000
+++ b/sql/sql_lex.cc	2010-08-11 10:39:26 +0000
@@ -2300,7 +2300,7 @@ void Query_tables_list::reset_query_tabl
   sroutines_list_own_last= sroutines_list.next;
   sroutines_list_own_elements= 0;
   binlog_stmt_flags= 0;
-  stmt_accessed_table_flag= 0; 
+  stmt_accessed_table_flag= 0;
 }
 
 
@@ -3145,3 +3145,150 @@ bool LEX::is_partition_management() cons
            alter_info.flags == ALTER_REORGANIZE_PARTITION));
 }
 
+
+#ifdef MYSQL_SERVER
+uint binlog_unsafe_map[256];
+
+#define UNSAFE(a, b, c) \
+  { \
+  DBUG_PRINT("unsafe_mixed_statement", ("SETTING BASE VALUES: %s, %s, %02X\n", \
+    LEX::stmt_accessed_table_string(a), \
+    LEX::stmt_accessed_table_string(b), \
+    c)); \
+  unsafe_mixed_statement(a, b, c); \
+  }
+
+/*
+  Sets the combination given by "a" and "b" and automatically combinations
+  given by other types of access, i.e. 2^(8 - 2), as unsafe.
+
+  It may happen a colision when automatically defining a combination as unsafe.
+  For that reason, a combination has its unsafe condition redefined only when
+  the new_condition is greater then the old. For instance,
+  
+     . (BINLOG_DIRECT_ON & TRX_CACHE_NOT_EMPTY) is never overwritten by 
+     . (BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF).
+*/
+void unsafe_mixed_statement(LEX::enum_stmt_accessed_table a,
+                            LEX::enum_stmt_accessed_table b, uint condition)
+{
+  int type= 0;
+  int index= (1U << a) | (1U << b);
+  
+  
+  for (type= 0; type < 256; type++)
+  {
+    if ((type & index) == index)
+    {
+      binlog_unsafe_map[type] |= condition;
+    }
+  }
+}
+/*
+  The BINLOG_* AND TRX_CACHE_* values can be combined by using '&' or '|',
+  which means that both conditions need to be satisfied or any of them is
+  enough. For example, 
+    
+    . BINLOG_DIRECT_ON & TRX_CACHE_NOT_EMPTY means that the statment is
+    unsafe when the option is on and trx-cache is not empty;
+
+    . BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF means the statement is unsafe
+    in all cases.
+
+    . TRX_CACHE_EMPTY | TRX_CACHE_NOT_EMPTY means the statement is unsafe
+    in all cases. Similar as above.
+*/
+void binlog_unsafe_map_init()
+{
+  memset((void*) binlog_unsafe_map, 0, sizeof(uint) * 256);
+
+  /*
+    Classify a statement as unsafe when there is a mixed statement and an
+    on-going transaction at any point of the execution if:
+
+      1. The mixed statement is about to update a transactional table and
+      a non-transactional table.
+
+      2. The mixed statement is about to update a transactional table and
+      read from a non-transactional table.
+
+      3. The mixed statement is about to update a non-transactional table
+      and temporary transactional table.
+
+      4. The mixed statement is about to update a temporary transactional
+      table and read from a non-transactional table.
+
+      5. The mixed statement is about to update a transactional table and
+      a temporary non-transactional table.
+     
+      6. The mixed statement is about to update a transactional table and
+      read from a temporary non-transactional table.
+
+      7. The mixed statement is about to update a temporary transactional
+      table and temporary non-transactional table.
+
+      8. The mixed statement is about to update a temporary transactional
+      table and read from a temporary non-transactional table.
+
+    After updating a transactional table if:
+
+      9. The mixed statement is about to update a non-transactional table
+      and read from a transactional table.
+
+      10. The mixed statement is about to update a non-transactional table
+      and read from a temporary transactional table.
+
+      11. The mixed statement is about to update a temporary non-transactional
+      table and read from a transactional table.
+      
+      12. The mixed statement is about to update a temporary non-transactional
+      table and read from a temporary transactional table.
+
+      13. The mixed statement is about to update a temporary non-transactional
+      table and read from a non-transactional table.
+
+    The reason for this is that locks acquired may not protected a concurrent
+    transaction of interfering in the current execution and by consequence in
+    the result.
+  */
+  /* Case 1. */
+  UNSAFE(LEX::STMT_WRITES_TRANS_TABLE, LEX::STMT_WRITES_NON_TRANS_TABLE,
+    BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF);
+  /* Case 2. */
+  UNSAFE(LEX::STMT_WRITES_TRANS_TABLE, LEX::STMT_READS_NON_TRANS_TABLE,
+    BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF);
+  /* Case 3. */
+  UNSAFE(LEX::STMT_WRITES_NON_TRANS_TABLE, LEX::STMT_WRITES_TEMP_TRANS_TABLE,
+    BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF);
+  /* Case 4. */
+  UNSAFE(LEX::STMT_WRITES_TEMP_TRANS_TABLE, LEX::STMT_READS_NON_TRANS_TABLE,
+    BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF);
+  /* Case 5. */
+  UNSAFE(LEX::STMT_WRITES_TRANS_TABLE, LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE,
+    BINLOG_DIRECT_ON);
+  /* Case 6. */
+  UNSAFE(LEX::STMT_WRITES_TRANS_TABLE, LEX::STMT_READS_TEMP_NON_TRANS_TABLE,
+    BINLOG_DIRECT_ON);
+  /* Case 7. */
+  UNSAFE(LEX::STMT_WRITES_TEMP_TRANS_TABLE, LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE,
+    BINLOG_DIRECT_ON);
+  /* Case 8. */
+  UNSAFE(LEX::STMT_WRITES_TEMP_TRANS_TABLE, LEX::STMT_READS_TEMP_NON_TRANS_TABLE,
+    BINLOG_DIRECT_ON);
+  /* Case 9. */
+  UNSAFE(LEX::STMT_WRITES_NON_TRANS_TABLE, LEX::STMT_READS_TRANS_TABLE,
+    (BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF) & TRX_CACHE_NOT_EMPTY);
+  /* Case 10 */
+  UNSAFE(LEX::STMT_WRITES_NON_TRANS_TABLE, LEX::STMT_READS_TEMP_TRANS_TABLE,
+    (BINLOG_DIRECT_ON | BINLOG_DIRECT_OFF) & TRX_CACHE_NOT_EMPTY);
+  /* Case 11. */
+  UNSAFE(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE, LEX::STMT_READS_TRANS_TABLE,
+    BINLOG_DIRECT_ON & TRX_CACHE_NOT_EMPTY);
+  /* Case 12. */
+  UNSAFE(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE, LEX::STMT_READS_TEMP_TRANS_TABLE,
+    BINLOG_DIRECT_ON & TRX_CACHE_NOT_EMPTY);
+  /* Case 13. */
+  UNSAFE(LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE, LEX::STMT_READS_NON_TRANS_TABLE,
+     BINLOG_DIRECT_OFF & TRX_CACHE_NOT_EMPTY);
+}
+#endif

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2010-08-10 11:32:54 +0000
+++ b/sql/sql_lex.h	2010-08-11 10:39:26 +0000
@@ -47,6 +47,53 @@ class Key;
 class File_parser;
 class Key_part_spec;
 
+#ifdef MYSQL_SERVER
+/*
+  There are 8 different type of table access so there is no more than
+  combinations 2^8 = 256:
+
+  . STMT_READS_TRANS_TABLE
+
+  . STMT_READS_NON_TRANS_TABLE
+
+  . STMT_READS_TEMP_TRANS_TABLE
+
+  . STMT_READS_TEMP_NON_TRANS_TABLE
+
+  . STMT_WRITES_TRANS_TABLE
+
+  . STMT_WRITES_NON_TRANS_TABLE
+
+  . STMT_WRITES_TEMP_TRANS_TABLE
+
+  . STMT_WRITES_TEMP_NON_TRANS_TABLE
+
+  The unsafe conditions for each combination is represented within a byte
+  and stores the status of the option --binlog-direct-non-trans-updates,
+  whether the trx-cache is empty or not, and whether the isolation level
+  is lower than ISO_REPEATABLE_READ:
+
+  . option (OFF/ON)
+  . trx-cache (empty/not empty)
+  . isolation (>= ISO_REPEATABLE_READ / < ISO_REPEATABLE_READ)
+
+  bits 0 : . OFF, . empty, . >= ISO_REPEATABLE_READ
+  bits 1 : . OFF, . empty, . < ISO_REPEATABLE_READ
+  bits 2 : . OFF, . not empty, . >= ISO_REPEATABLE_READ
+  bits 3 : . OFF, . not empty, . < ISO_REPEATABLE_READ
+  bits 4 : . ON, . empty, . >= ISO_REPEATABLE_READ
+  bits 5 : . ON, . empty, . < ISO_REPEATABLE_READ
+  bits 6 : . ON, . not empty, . >= ISO_REPEATABLE_READ
+  bits 7 : . ON, . not empty, . < ISO_REPEATABLE_READ
+*/
+extern uint binlog_unsafe_map[256];
+/*
+  Initializes the array with unsafe combinations and its respective
+  conditions.
+*/
+void binlog_unsafe_map_init();
+#endif
+
 /**
   used by the parser to store internal variable name
 */
@@ -1284,33 +1331,33 @@ public:
     */
     STMT_READS_TRANS_TABLE= 0,
     /*
-       If a transactional table is about to be updated.
-    */
-    STMT_WRITES_TRANS_TABLE,
-    /*
        If a non-transactional table is about to be read. Note that
        a write implies a read.
     */
     STMT_READS_NON_TRANS_TABLE,
     /*
-       If a non-transactional table is about to be updated.
-    */
-    STMT_WRITES_NON_TRANS_TABLE,
-    /*
        If a temporary transactional table is about to be read. Note
        that a write implies a read.
     */
     STMT_READS_TEMP_TRANS_TABLE,
     /*
-       If a temporary transactional table is about to be updated.
-    */
-    STMT_WRITES_TEMP_TRANS_TABLE,
-    /*
        If a temporary non-transactional table is about to be read. Note
       that a write implies a read.
     */
     STMT_READS_TEMP_NON_TRANS_TABLE,
     /*
+       If a transactional table is about to be updated.
+    */
+    STMT_WRITES_TRANS_TABLE,
+    /*
+       If a non-transactional table is about to be updated.
+    */
+    STMT_WRITES_NON_TRANS_TABLE,
+    /*
+       If a temporary transactional table is about to be updated.
+    */
+    STMT_WRITES_TEMP_TRANS_TABLE,
+    /*
        If a temporary non-transactional table is about to be updated.
     */
     STMT_WRITES_TEMP_NON_TRANS_TABLE,
@@ -1320,7 +1367,58 @@ public:
     */
     STMT_ACCESS_TABLE_COUNT
   };
+
+  static inline const char *stmt_accessed_table_string(enum_stmt_accessed_table accessed_table)
+  {
+    switch (accessed_table)
+    {
+      case STMT_READS_TRANS_TABLE:
+         return "STMT_READS_TRANS_TABLE";
+      break;
+      case STMT_READS_NON_TRANS_TABLE:
+        return "STMT_READS_NON_TRANS_TABLE";
+      break;
+      case STMT_READS_TEMP_TRANS_TABLE:
+        return "STMT_READS_TEMP_TRANS_TABLE";
+      break;
+      case STMT_READS_TEMP_NON_TRANS_TABLE:
+        return "STMT_READS_TEMP_NON_TRANS_TABLE";
+      break;  
+      case STMT_WRITES_TRANS_TABLE:
+        return "STMT_WRITES_TRANS_TABLE";
+      break;
+      case STMT_WRITES_NON_TRANS_TABLE:
+        return "STMT_WRITES_NON_TRANS_TABLE";
+      break;
+      case STMT_WRITES_TEMP_TRANS_TABLE:
+        return "STMT_WRITES_TEMP_TRANS_TABLE";
+      break;
+      case STMT_WRITES_TEMP_NON_TRANS_TABLE:
+        return "STMT_WRITES_TEMP_NON_TRANS_TABLE";
+      break;
+      case STMT_ACCESS_TABLE_COUNT:
+      default:
+        DBUG_ASSERT(0);
+      break;
+    }
+  }
                
+  #define BINLOG_DIRECT_ON 0xF0    /* unsafe when
+                                      --binlog-direct-non-trans-updates
+                                      is ON */
+
+  #define BINLOG_DIRECT_OFF 0xF    /* unsafe when
+                                      --binlog-direct-non-trans-updates
+                                      is OFF */
+
+  #define TRX_CACHE_EMPTY 0x33     /* unsafe when trx-cache is empty */
+
+  #define TRX_CACHE_NOT_EMPTY 0xCC /* unsafe when trx-cache is not empty */
+
+  #define IL_LT_REPEATABLE 0xAA    /* unsafe when < ISO_REPEATABLE_READ */
+
+  #define IL_GTE_REPEATABLE 0x55   /* unsafe when >= ISO_REPEATABLE_READ */
+  
   /**
     Sets the type of table that is about to be accessed while executing a
     statement.
@@ -1330,7 +1428,7 @@ public:
   */
   inline void set_stmt_accessed_table(enum_stmt_accessed_table accessed_table)
   {
-    DBUG_ENTER("THD::set_stmt_accessed_table");
+    DBUG_ENTER("LEX::set_stmt_accessed_table");
 
     DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
     stmt_accessed_table_flag |= (1U << accessed_table);
@@ -1343,7 +1441,7 @@ public:
     statement.
 
     @param accessed_table Enumeration type that defines the type of table,
-                           e.g. temporary, transactional, non-transactional.
+           e.g. temporary, transactional, non-transactional.
 
     @return
       @retval TRUE  if the type of the table is about to be accessed
@@ -1351,7 +1449,7 @@ public:
   */
   inline bool stmt_accessed_table(enum_stmt_accessed_table accessed_table)
   {
-    DBUG_ENTER("THD::stmt_accessed_table");
+    DBUG_ENTER("LEX::stmt_accessed_table");
 
     DBUG_ASSERT(accessed_table >= 0 && accessed_table < STMT_ACCESS_TABLE_COUNT);
 
@@ -1359,40 +1457,80 @@ public:
   }
 
   /**
-    Checks if a temporary table is about to be accessed while executing a
-    statement.
+    Checks if a temporary non-transactional table is about to be accessed
+    while executing a statement.
 
     @return
-      @retval TRUE  if a temporary table is about to be accessed
+      @retval TRUE  if a temporary non-transactional table is about to be
+                    accessed
       @retval FALSE otherwise
   */
-  inline bool stmt_accessed_temp_table()
+  inline bool stmt_accessed_non_trans_temp_table()
   {
-    DBUG_ENTER("THD::stmt_accessed_temp_table");
+    DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
 
     DBUG_RETURN((stmt_accessed_table_flag &
-                ((1U << STMT_READS_TEMP_TRANS_TABLE) |
-                 (1U << STMT_WRITES_TEMP_TRANS_TABLE) |
-                 (1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
+                ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
                  (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
   }
 
-  /**
-    Checks if a temporary non-transactional table is about to be accessed
-    while executing a statement.
+  /*
+    Checks if a mixed statement is unsafe.
 
+    
+    @param in_multi_stmt_transaction_mode defines if there is an on-going
+           multi-transactional statement.
+    @param binlog_direct defines if --binlog-direct-non-trans-updates is
+           active.
+    @param trx_cache_is_not_empty defines if the trx-cache is empty or not.
+    @param trx_isolation defines the isolation level.
+ 
     @return
-      @retval TRUE  if a temporary non-transactional table is about to be
-                    accessed
+      @retval TRUE if the mixed statement is unsafe
       @retval FALSE otherwise
   */
-  inline bool stmt_accessed_non_trans_temp_table()
+  inline bool is_mixed_stmt_unsafe(bool in_multi_stmt_transaction_mode,
+                                   bool binlog_direct,
+                                   bool trx_cache_is_not_empty,
+                                   uint tx_isolation)
   {
-    DBUG_ENTER("THD::stmt_accessed_non_trans_temp_table");
+    bool unsafe= FALSE;
 
-    DBUG_RETURN((stmt_accessed_table_flag &
-                ((1U << STMT_READS_TEMP_NON_TRANS_TABLE) |
-                 (1U << STMT_WRITES_TEMP_NON_TRANS_TABLE))) != 0);
+    if (in_multi_stmt_transaction_mode)
+    {
+       uint condition=
+         (binlog_direct ? BINLOG_DIRECT_ON : BINLOG_DIRECT_OFF) &
+         (trx_cache_is_not_empty ? TRX_CACHE_NOT_EMPTY : TRX_CACHE_EMPTY) &
+         (tx_isolation >= ISO_REPEATABLE_READ ? IL_GTE_REPEATABLE : IL_LT_REPEATABLE);
+
+      unsafe= (binlog_unsafe_map[stmt_accessed_table_flag] & condition);
+
+#if !defined(DBUG_OFF)
+      DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("RESULT %02X %02X %02X\n", condition,
+              binlog_unsafe_map[stmt_accessed_table_flag],
+              (binlog_unsafe_map[stmt_accessed_table_flag] & condition)));
+ 
+      int type_in= 0;
+      for (; type_in < STMT_ACCESS_TABLE_COUNT; type_in++)
+      {
+        if (stmt_accessed_table((enum_stmt_accessed_table) type_in))
+          DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("ACCESSED %s ",
+                  stmt_accessed_table_string((enum_stmt_accessed_table) type_in)));
+      }
+#endif
+
+      if (stmt_accessed_table(STMT_WRITES_NON_TRANS_TABLE) &&
+        stmt_accessed_table(STMT_READS_TRANS_TABLE) &&
+        tx_isolation < ISO_REPEATABLE_READ)
+        unsafe= TRUE;
+      else if (stmt_accessed_table(STMT_WRITES_TEMP_NON_TRANS_TABLE) &&
+        stmt_accessed_table(STMT_READS_TRANS_TABLE) &&
+        tx_isolation < ISO_REPEATABLE_READ)
+      unsafe= TRUE;
+ 
+    }
+
+    return(unsafe);
   }
 
   /**

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-07-29 12:32:11 +0000
+++ b/sql/sql_table.cc	2010-08-11 10:39:26 +0000
@@ -1799,6 +1799,8 @@ end:
     clear_error                   is clear_error to be called
     query                         Query to log
     query_length                  Length of query
+    is_trans                      if the event changes either
+                                  a trans or non-trans engine.
 
   RETURN VALUES
     NONE
@@ -1921,18 +1923,64 @@ int mysql_rm_table_part2(THD *thd, TABLE
   String wrong_tables;
   int error= 0;
   int non_temp_tables_count= 0;
-  bool some_tables_deleted=0, tmp_table_deleted=0, foreign_key_error=0;
+  bool foreign_key_error=0;
+  bool non_tmp_error= 0;
+  bool trans_tmp_table_deleted= 0, non_trans_tmp_table_deleted= 0;
+  bool non_tmp_table_deleted= 0;
   String built_query;
-  String built_tmp_query;
+  String built_trans_tmp_query, built_non_trans_tmp_query;
   DBUG_ENTER("mysql_rm_table_part2");
 
-  if (thd->is_current_stmt_binlog_format_row() && !dont_log_query)
+  /*
+    Prepares the drop statements that will be written into the binary
+    log as follows:
+
+    1 - If we are not processing a "DROP TEMPORARY" it prepares a
+    "DROP".
+
+    2 - A "DROP" may result in a "DROP TEMPORARY" but the opposite is
+    not true.
+
+    3 - If the current format is row, the IF EXISTS token needs to be
+    appended because one does not know if CREATE TEMPORARY was previously
+    written to the binary log.
+
+    4 - Add the IF_EXISTS token if necessary, i.e. if_exists is TRUE.
+
+    5 - For temporary tables, there is a need to differentiate tables
+    in transactional and non-transactional storage engines. For that,
+    reason, two types of drop statements are prepared.
+
+    The need to different the type of tables when dropping a temporary
+    table stems from the fact that such drop does not commit an ongoing
+    transaction and changes to non-transactional tables must be written
+    ahead of the transaction in some circumstances.
+  */
+  if (!dont_log_query)
   {
-    built_query.set_charset(system_charset_info);
-    if (if_exists)
-      built_query.append("DROP TABLE IF EXISTS ");
+    if (!drop_temporary)
+    {
+      built_query.set_charset(system_charset_info);
+      if (if_exists)
+        built_query.append("DROP TABLE IF EXISTS ");
+      else
+        built_query.append("DROP TABLE ");
+    }
+
+    if (thd->is_current_stmt_binlog_format_row() || if_exists)
+    {
+      built_trans_tmp_query.set_charset(system_charset_info);
+      built_trans_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS ");
+      built_non_trans_tmp_query.set_charset(system_charset_info);
+      built_non_trans_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS ");
+    }
     else
-      built_query.append("DROP TABLE ");
+    {
+      built_trans_tmp_query.set_charset(system_charset_info);
+      built_trans_tmp_query.append("DROP TEMPORARY TABLE ");
+      built_non_trans_tmp_query.set_charset(system_charset_info);
+      built_non_trans_tmp_query.append("DROP TEMPORARY TABLE ");
+    }
   }
 
   mysql_ha_rm_tables(thd, tables);
@@ -2001,6 +2049,7 @@ int mysql_rm_table_part2(THD *thd, TABLE
 
   for (table= tables; table; table= table->next_local)
   {
+    bool is_trans;
     char *db=table->db;
     handlerton *table_type;
     enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN;
@@ -2009,78 +2058,70 @@ int mysql_rm_table_part2(THD *thd, TABLE
                          table->db, table->table_name, (long) table->table,
                          table->table ? (long) table->table->s : (long) -1));
 
+    /*
+      drop_temporary_table may return one of the following error codes:
+      .  0 - a temporary table was successfully dropped.
+      .  1 - a temporary table was not found.
+      . -1 - a temporary table is used by an outer statement.
+    */
     if (table->open_type == OT_BASE_ONLY)
       error= 1;
-    else
-      error= drop_temporary_table(thd, table);
- 
-    switch (error) {
-    case  0:
-      // removed temporary table
-      tmp_table_deleted= 1;
+    else if ((error= drop_temporary_table(thd, table, &is_trans)) == -1)
+    {
+      DBUG_ASSERT(thd->in_sub_stmt);
+      goto err;
+    }
+
+    if ((drop_temporary && if_exists) || !error)
+    {
       /*
-        One needs to always log any temporary table drop if the current
-        statement logging format is set to row. This happens because one
-        might have created a temporary table while the statement logging
-        format was statement and then switched to mixed or row format.
+        This handles the case of temporary tables. We have the following cases:
+
+          . "DROP TEMPORARY" was executed and a temporary table was affected
+          (i.e. drop_temporary && !error) or the if_exists was specified (i.e.
+          drop_temporary && if_exists).
+
+          . "DROP" was executed but a temporary table was affected (.i.e
+          !error).
       */
-      if (thd->is_current_stmt_binlog_format_row())
+      if (!dont_log_query)
       {
-        if (built_tmp_query.is_empty()) 
-        {
-          built_tmp_query.set_charset(system_charset_info);
-          built_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS ");
-        }
+        /*
+          If there is an error, we don't know the type of the engine
+          at this point. So, we keep it in the trx-cache.
+        */
+        is_trans= error ? TRUE : is_trans;
+        if (is_trans)
+          trans_tmp_table_deleted= TRUE;
+        else
+          non_trans_tmp_table_deleted= TRUE;
 
-        built_tmp_query.append("`");
+        String *built_ptr_query=
+          (is_trans ? &built_trans_tmp_query : &built_non_trans_tmp_query);
+        /*
+          Don't write the database name if it is the current one (or if
+          thd->db is NULL).
+        */
+        built_ptr_query->append("`");
         if (thd->db == NULL || strcmp(db,thd->db) != 0)
         {
-          built_tmp_query.append(db);
-          built_tmp_query.append("`.`");
+          built_ptr_query->append(db);
+          built_ptr_query->append("`.`");
         }
-        built_tmp_query.append(table->table_name);
-        built_tmp_query.append("`,");
+        built_ptr_query->append(table->table_name);
+        built_ptr_query->append("`,");
       }
-
-      continue;
-    case -1:
-      DBUG_ASSERT(thd->in_sub_stmt);
-      error= 1;
-      goto err;
-    default:
-      // temporary table not found
-      error= 0;
-    }
-
-    /* Probably a non-temporary table. */
-    if (!drop_temporary)
-      non_temp_tables_count++;
-
-    /*
-      If row-based replication is used and the table is not a
-      temporary table, we add the table name to the drop statement
-      being built.  The string always end in a comma and the comma
-      will be chopped off before being written to the binary log.
-      */
-    if (!drop_temporary && thd->is_current_stmt_binlog_format_row() && !dont_log_query)
-    {
       /*
-        Don't write the database name if it is the current one (or if
-        thd->db is NULL).
+        This means that a temporary table was droped and as such there
+        is no need to proceed with the code that tries to drop a regular
+        table.
       */
-      built_query.append("`");
-      if (thd->db == NULL || strcmp(db,thd->db) != 0)
-      {
-        built_query.append(db);
-        built_query.append("`.`");
-      }
-
-      built_query.append(table->table_name);
-      built_query.append("`,");
+      if (!error) continue;
     }
-
-    if (!drop_temporary)
+    else if (!drop_temporary)
     {
+      non_temp_tables_count++;
+
       if (thd->locked_tables_mode)
       {
         if (wait_while_table_is_used(thd, table->table, HA_EXTRA_FORCE_REOPEN))
@@ -2103,7 +2144,38 @@ int mysql_rm_table_part2(THD *thd, TABLE
                                         reg_ext,
                                         table->internal_tmp_table ?
                                         FN_IS_TMP : 0);
+
+      /*
+        This handles the case where a "DROP" was executed and a regular
+        table "may be" dropped as drop_temporary is FALSE and error is
+        TRUE. If the error was FALSE a temporary table was dropped and
+        regardless of the status of drop_tempoary a "DROP TEMPORARY"
+        must be used.
+      */
+      if (!dont_log_query)
+      {
+        /*
+          Note that unless if_exists is TRUE or a temporary table was deleted, 
+          there is no means to know if the statement should be written to the
+          binary log. See further information on this variable in what follows.
+        */
+        non_tmp_table_deleted= (if_exists ? TRUE : non_tmp_table_deleted);
+        /*
+          Don't write the database name if it is the current one (or if
+          thd->db is NULL).
+        */
+        built_query.append("`");
+        if (thd->db == NULL || strcmp(db,thd->db) != 0)
+        {
+          built_query.append(db);
+          built_query.append("`.`");
+        }
+
+        built_query.append(table->table_name);
+        built_query.append("`,");
+      }
     }
+
     /*
       TODO: Investigate what should be done to remove this lock completely.
             Is exclusive meta-data lock enough ?
@@ -2112,19 +2184,29 @@ int mysql_rm_table_part2(THD *thd, TABLE
     DBUG_EXECUTE_IF("sleep_before_part2_delete_table",
                     my_sleep(100000););
     mysql_mutex_lock(&LOCK_open);
+    error= 0;
     if (drop_temporary ||
         ((access(path, F_OK) &&
           ha_create_table_from_engine(thd, db, alias)) ||
          (!drop_view &&
           dd_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
     {
-      // Table was not found on disk and table can't be created from engine
+      /*
+        One of the following cases happened:
+          . "DROP TEMPORARY" but a temporary table was not found.
+          . "DROP" but table was not found on disk and table can't be
+            created from engine.
+          . ./sql/datadict.cc +32 /Alfranio - TODO: We need to test this.
+      */
       if (if_exists)
 	push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 			    ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
 			    table->table_name);
       else
+      {
+        non_tmp_error = (drop_temporary ? non_tmp_error : TRUE);
         error= 1;
+      }
     }
     else
     {
@@ -2157,7 +2239,7 @@ int mysql_rm_table_part2(THD *thd, TABLE
       if (error == HA_ERR_ROW_IS_REFERENCED)
       {
 	/* the table is referenced by a foreign key constraint */
-	foreign_key_error=1;
+	foreign_key_error= 1;
       }
       if (!error || error == ENOENT || error == HA_ERR_NO_SUCH_TABLE)
       {
@@ -2166,12 +2248,13 @@ int mysql_rm_table_part2(THD *thd, TABLE
 	strmov(end,reg_ext);
         if (!(new_error= mysql_file_delete(key_file_frm, path, MYF(MY_WME))))
         {
-	  some_tables_deleted=1;
+          non_tmp_table_deleted= TRUE;
           new_error= Table_triggers_list::drop_all_triggers(thd, db,
                                                             table->table_name);
         }
         error|= new_error;
       }
+       non_tmp_error= error ? TRUE : non_tmp_error;
     }
     mysql_mutex_unlock(&LOCK_open);
     if (error)
@@ -2187,11 +2270,12 @@ int mysql_rm_table_part2(THD *thd, TABLE
                     my_printf_error(ER_BAD_TABLE_ERROR,
                                     ER(ER_BAD_TABLE_ERROR), MYF(0),
                                     table->table_name););
-
   }
   DEBUG_SYNC(thd, "rm_table_part2_before_binlog");
-  thd->thread_specific_used|= tmp_table_deleted;
+  thd->thread_specific_used|= (trans_tmp_table_deleted ||
+                               non_trans_tmp_table_deleted);
   error= 0;
+err:
   if (wrong_tables.length())
   {
     if (!foreign_key_error)
@@ -2202,85 +2286,48 @@ int mysql_rm_table_part2(THD *thd, TABLE
     error= 1;
   }
 
-  if (some_tables_deleted || tmp_table_deleted || !error)
+  if (non_trans_tmp_table_deleted ||
+      trans_tmp_table_deleted || non_tmp_table_deleted)
   {
     query_cache_invalidate3(thd, tables, 0);
     if (!dont_log_query && mysql_bin_log.is_open())
     {
-      if (!thd->is_current_stmt_binlog_format_row() ||
-          (non_temp_tables_count > 0 && !tmp_table_deleted))
+      if (non_trans_tmp_table_deleted)
       {
-        /*
-          In this case, we are either using statement-based
-          replication or using row-based replication but have only
-          deleted one or more non-temporary tables (and no temporary
-          tables).  In this case, we can write the original query into
-          the binary log.
-        */
-        error |= write_bin_log(thd, !error, thd->query(), thd->query_length());
+          /* Chop of the last comma */
+          built_non_trans_tmp_query.chop();
+          built_non_trans_tmp_query.append(" /* generated by server */");
+          error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
+                                     built_non_trans_tmp_query.ptr(),
+                                     built_non_trans_tmp_query.length(),
+                                     FALSE, FALSE, FALSE, 0);
+      }
+      if (trans_tmp_table_deleted)
+      {
+          /* Chop of the last comma */
+          built_trans_tmp_query.chop();
+          built_trans_tmp_query.append(" /* generated by server */");
+          error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
+                                     built_trans_tmp_query.ptr(),
+                                     built_trans_tmp_query.length(),
+                                     TRUE, FALSE, FALSE, 0);
       }
-      else if (thd->is_current_stmt_binlog_format_row() &&
-               tmp_table_deleted)
+      if (non_tmp_table_deleted)
       {
-        if (non_temp_tables_count > 0)
-        {
-          /*
-            In this case we have deleted both temporary and
-            non-temporary tables, so:
-            - since we have deleted a non-temporary table we have to
-              binlog the statement, but
-            - since we have deleted a temporary table we cannot binlog
-              the statement (since the table may have not been created on the
-              slave - check "if" branch below, this might cause the slave to 
-              stop).
-
-            Instead, we write a built statement, only containing the
-            non-temporary tables, to the binary log
-          */
-          built_query.chop();                  // Chop of the last comma
+          /* Chop of the last comma */
+          built_query.chop();
           built_query.append(" /* generated by server */");
-          error|= write_bin_log(thd, !error, built_query.ptr(), built_query.length());
-        }
-
-        /*
-          One needs to always log any temporary table drop if the current
-          statement logging format is set to row. This happens because one
-          might have created a temporary table while the statement logging
-          format was statement and then switched to mixed or row format.
-        */
-        if (thd->is_current_stmt_binlog_format_row())
-        {
-          /*
-            In this case we have deleted some temporary tables but we are using
-            row based logging for the statement. However, thread uses mixed mode
-            format, thence we need to log the dropping as we cannot tell for
-            sure whether the create was logged as statement previously or not, ie,
-            before switching to row mode.
-          */
-          built_tmp_query.chop();                  // Chop of the last comma
-          built_tmp_query.append(" /* generated by server */");
-          /*
-            We cannot call the write_bin_log as we do not care about any errors
-            in the master as the statement is always DROP TEMPORARY TABLE IF EXISTS
-            and as such there will be no errors in the slave.
-          */
-          error|= thd->binlog_query(THD::STMT_QUERY_TYPE, built_tmp_query.ptr(),
-                                    built_tmp_query.length(), FALSE, FALSE, FALSE,
-                                    0);
-        }
+          int error_code = (non_tmp_error ?
+            (foreign_key_error ? ER_ROW_IS_REFERENCED : ER_BAD_TABLE_ERROR) : 0);
+          error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
+                                     built_query.ptr(),
+                                     built_query.length(),
+                                     TRUE, FALSE, FALSE,
+                                     error_code);
       }
-
-      /*
-        The remaining cases are:
-        - no tables were deleted and
-        - only temporary tables were deleted and row-based
-          replication is used.
-        In both these cases, nothing should be written to the binary
-        log.
-      */
     }
   }
-err:
+
   if (!drop_temporary)
   {
     /*
@@ -3795,6 +3842,8 @@ void sp_prepare_create_field(THD *thd, C
     internal_tmp_table  Set to 1 if this is an internal temporary table
 			(From ALTER TABLE)
     select_field_count
+    is_trans            identifies the type of engine where the table
+                        was created: either trans or non-trans.
 
   DESCRIPTION
     If one creates a temporary table, this is automatically opened
@@ -3819,7 +3868,8 @@ bool mysql_create_table_no_lock(THD *thd
                                 HA_CREATE_INFO *create_info,
                                 Alter_info *alter_info,
                                 bool internal_tmp_table,
-                                uint select_field_count)
+                                uint select_field_count,
+                                bool *is_trans)
 {
   char		path[FN_REFLEN + 1];
   uint          path_length;
@@ -4186,12 +4236,17 @@ bool mysql_create_table_no_lock(THD *thd
 
   if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
   {
+    TABLE *table= NULL;
     /* Open table and put in temporary table list */
-    if (!(open_temporary_table(thd, path, db, table_name, 1)))
+    if (!(table= open_temporary_table(thd, path, db, table_name, 1)))
     {
       (void) rm_temporary_table(create_info->db_type, path);
       goto unlock_and_end;
     }
+
+    if (is_trans != NULL)
+      *is_trans= table->file->has_transactions();
+
     thd->thread_specific_used= TRUE;
   }
 
@@ -4243,9 +4298,10 @@ bool mysql_create_table(THD *thd, TABLE_
   /* Got lock. */
   DEBUG_SYNC(thd, "locked_table_name");
 
+  bool is_trans;
   result= mysql_create_table_no_lock(thd, create_table->db,
                                      create_table->table_name, create_info,
-                                     alter_info, FALSE, 0);
+                                     alter_info, FALSE, 0, &is_trans);
 
   /*
     Don't write statement if:
@@ -4257,7 +4313,7 @@ bool mysql_create_table(THD *thd, TABLE_
       (!thd->is_current_stmt_binlog_format_row() ||
        (thd->is_current_stmt_binlog_format_row() &&
         !(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
-    result= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+    result= write_bin_log(thd, TRUE, thd->query(), thd->query_length(), is_trans);
 
 end:
   DBUG_RETURN(result);
@@ -5342,9 +5398,10 @@ bool mysql_create_like_table(THD* thd, T
   /* Reset auto-increment counter for the new table. */
   local_create_info.auto_increment_value= 0;
 
+  bool is_trans;
   if ((res= mysql_create_table_no_lock(thd, table->db, table->table_name,
                                        &local_create_info, &local_alter_info,
-                                       FALSE, 0)))
+                                       FALSE, 0, &is_trans)))
     goto err;
 
   /*
@@ -5427,7 +5484,7 @@ bool mysql_create_like_table(THD* thd, T
       Case 3 and 4 does nothing under RBR
     */
   }
-  else if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
+  else if (write_bin_log(thd, TRUE, thd->query(), thd->query_length(), is_trans))
     goto err;
 
 err:
@@ -7140,7 +7197,7 @@ bool mysql_alter_table(THD *thd,char *ne
   error= mysql_create_table_no_lock(thd, new_db, tmp_name,
                                     create_info,
                                     alter_info,
-                                    1, 0);
+                                    1, 0, NULL);
   reenable_binlog(thd);
   if (error)
     goto err;

=== modified file 'sql/sql_table.h'
--- a/sql/sql_table.h	2010-07-01 13:53:46 +0000
+++ b/sql/sql_table.h	2010-08-11 10:39:26 +0000
@@ -138,7 +138,8 @@ bool mysql_create_table_no_lock(THD *thd
                                 const char *table_name,
                                 HA_CREATE_INFO *create_info,
                                 Alter_info *alter_info,
-                                bool tmp_table, uint select_field_count);
+                                bool tmp_table, uint select_field_count,
+                                bool *is_trans);
 
 bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
                        HA_CREATE_INFO *create_info,


Attachment: [text/bzr-bundle]
Thread
bzr commit into mysql-5.5-bugfixing branch (alfranio.correia:3173)Bug#53452Alfranio Correia11 Aug