List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:July 13 2010 8:39am
Subject:bzr commit into mysql-trunk-runtime branch (jon.hauglid:3078)
View as plain text  
#At file:///export/home/x/mysql-trunk-runtime-test/ based on revid:jon.hauglid@stripped

 3078 Jon Olav Hauglid	2010-07-13 [merge]
      merge from mysql-trunk-bugfixing

    removed:
      dbug/sanity.c
      mysql-test/suite/rpl/r/rpl_temp_temporary.result
      mysql-test/suite/rpl/t/rpl_temp_temporary-master.opt
      mysql-test/suite/rpl/t/rpl_temp_temporary.test
      mysql-test/t/mysql-bug45236-master.opt
      mysys/my_realloc.c
      mysys/safemalloc.c
    added:
      mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
      mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test
      mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result
      mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result
      mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result
      mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test
      mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test
      mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test
      unittest/mysys/my_malloc-t.c
    renamed:
      mysql-test/r/analyse.result => mysql-test/r/func_analyse.result
      mysql-test/t/analyse.test => mysql-test/t/func_analyse.test
    modified:
      BUILD/SETUP.sh
      BUILD/build_mccge.sh
      BUILD/compile-ia64-debug-max
      CMakeLists.txt
      client/completion_hash.cc
      client/mysql.cc
      client/mysqladmin.cc
      client/mysqlbinlog.cc
      client/mysqlcheck.c
      client/mysqldump.c
      client/mysqlimport.c
      client/mysqlshow.c
      client/mysqlslap.c
      client/mysqltest.cc
      client/readline.cc
      client/sql_string.h
      cmake/install_macros.cmake
      configure.in
      dbug/CMakeLists.txt
      dbug/Makefile.am
      dbug/dbug.c
      dbug/user.r
      extra/comp_err.c
      extra/my_print_defaults.c
      extra/replace.c
      include/hash.h
      include/lf.h
      include/my_global.h
      include/my_list.h
      include/my_nosys.h
      include/my_sys.h
      include/mysql.h.pp
      include/mysql/psi/mysql_file.h
      include/mysql/psi/mysql_thread.h
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h
      include/mysql/psi/psi_abi_v2.h
      include/typelib.h
      libmysql/Makefile.am
      libmysql/Makefile.shared
      libmysql/libmysql.c
      libmysqld/lib_sql.cc
      libmysqld/libmysqld.c
      mysql-test/extra/binlog_tests/drop_temp_table.test
      mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
      mysql-test/include/ctype_numconv.inc
      mysql-test/include/mysqld--help.inc
      mysql-test/lib/v1/mtr_report.pl
      mysql-test/lib/v1/mysql-test-run.pl
      mysql-test/mysql-stress-test.pl
      mysql-test/mysql-test-run.pl
      mysql-test/r/ctype_binary.result
      mysql-test/r/ctype_cp1251.result
      mysql-test/r/ctype_latin1.result
      mysql-test/r/ctype_ucs.result
      mysql-test/r/func_digest.result
      mysql-test/r/information_schema.result
      mysql-test/r/partition_innodb.result
      mysql-test/r/select.result
      mysql-test/r/sp_trans_log.result
      mysql-test/suite/binlog/r/binlog_multi_engine.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_drop_tmp_tbl.result
      mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
      mysql-test/suite/funcs_1/r/is_engines_myisam.result
      mysql-test/suite/ndb/r/ndb_binlog_format.result
      mysql-test/suite/ndb/t/disabled.def
      mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
      mysql-test/suite/rpl/r/rpl_concurrency_error.result
      mysql-test/suite/rpl/r/rpl_drop_temp.result
      mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.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_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
      mysql-test/suite/rpl/t/rpl_drop_temp.test
      mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test
      mysql-test/suite/rpl_ndb/t/disabled.def
      mysql-test/suite/sys_vars/r/large_files_support_basic.result
      mysql-test/suite/sys_vars/r/sql_select_limit_func.result
      mysql-test/suite/sys_vars/t/sql_select_limit_func.test
      mysql-test/t/bug46080-master.opt
      mysql-test/t/disabled.def
      mysql-test/t/func_digest.test
      mysql-test/t/innodb_mysql_lock2.test
      mysql-test/t/partition_innodb.test
      mysql-test/t/select.test
      mysql-test/t/sp_trans_log.test
      mysys/CMakeLists.txt
      mysys/Makefile.am
      mysys/array.c
      mysys/charset.c
      mysys/default_modify.c
      mysys/hash.c
      mysys/lf_alloc-pin.c
      mysys/lf_dynarray.c
      mysys/lf_hash.c
      mysys/list.c
      mysys/mf_cache.c
      mysys/mf_iocache.c
      mysys/mf_keycache.c
      mysys/mf_keycaches.c
      mysys/mf_sort.c
      mysys/mf_tempdir.c
      mysys/mf_wfile.c
      mysys/my_alloc.c
      mysys/my_bitmap.c
      mysys/my_compress.c
      mysys/my_error.c
      mysys/my_file.c
      mysys/my_fopen.c
      mysys/my_gethwaddr.c
      mysys/my_getopt.c
      mysys/my_init.c
      mysys/my_largepage.c
      mysys/my_lib.c
      mysys/my_lockmem.c
      mysys/my_malloc.c
      mysys/my_once.c
      mysys/my_open.c
      mysys/my_windac.c
      mysys/queues.c
      mysys/stacktrace.c
      mysys/string.c
      mysys/test_charset.c
      mysys/testhash.c
      mysys/thr_alarm.c
      mysys/tree.c
      mysys/trie.c
      packaging/WiX/CPackWixConfig.cmake
      plugin/daemon_example/daemon_example.cc
      plugin/semisync/semisync_master.h
      scripts/mysql_config.pl.in
      scripts/mysql_config.sh
      sql-common/client.c
      sql/CMakeLists.txt
      sql/debug_sync.cc
      sql/derror.cc
      sql/event_data_objects.cc
      sql/event_scheduler.cc
      sql/examples/CMakeLists.txt
      sql/filesort.cc
      sql/gstream.h
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_partition.cc
      sql/handler.cc
      sql/handler.h
      sql/item.h
      sql/item_func.cc
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/keycaches.cc
      sql/lock.cc
      sql/log.cc
      sql/log.h
      sql/log_event.cc
      sql/log_event.h
      sql/log_event_old.cc
      sql/mdl.cc
      sql/mysqld.cc
      sql/net_serv.cc
      sql/opt_range.cc
      sql/records.cc
      sql/repl_failsafe.cc
      sql/rpl_filter.cc
      sql/rpl_handler.cc
      sql/rpl_injector.cc
      sql/rpl_mi.cc
      sql/rpl_rli.cc
      sql/rpl_utility.cc
      sql/slave.cc
      sql/sp_pcontext.cc
      sql/sp_rcontext.cc
      sql/sql_base.cc
      sql/sql_binlog.cc
      sql/sql_cache.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_db.cc
      sql/sql_handler.cc
      sql/sql_insert.cc
      sql/sql_lex.cc
      sql/sql_list.h
      sql/sql_load.cc
      sql/sql_locale.cc
      sql/sql_manager.cc
      sql/sql_map.cc
      sql/sql_parse.cc
      sql/sql_partition.cc
      sql/sql_plugin.cc
      sql/sql_plugin.h
      sql/sql_profile.cc
      sql/sql_profile.h
      sql/sql_select.cc
      sql/sql_show.cc
      sql/sql_string.h
      sql/sql_table.cc
      sql/sql_test.cc
      sql/sql_truncate.cc
      sql/sys_vars.cc
      sql/sys_vars.h
      sql/table.cc
      sql/uniques.cc
      sql/unireg.cc
      storage/archive/archive_reader.c
      storage/archive/ha_archive.cc
      storage/blackhole/ha_blackhole.cc
      storage/csv/ha_tina.cc
      storage/csv/ha_tina.h
      storage/csv/transparent_file.cc
      storage/example/ha_example.cc
      storage/heap/ha_heap.cc
      storage/heap/hp_block.c
      storage/heap/hp_close.c
      storage/heap/hp_create.c
      storage/heap/hp_rename.c
      storage/ibmdb2i/db2i_constraints.cc
      storage/ibmdb2i/db2i_conversion.cc
      storage/ibmdb2i/db2i_file.cc
      storage/ibmdb2i/db2i_file.h
      storage/ibmdb2i/db2i_global.h
      storage/ibmdb2i/db2i_ileBridge.cc
      storage/ibmdb2i/db2i_ileBridge.h
      storage/ibmdb2i/ha_ibmdb2i.cc
      storage/innobase/handler/ha_innodb.cc
      storage/myisam/ft_boolean_search.c
      storage/myisam/ft_nlq_search.c
      storage/myisam/ft_stopwords.c
      storage/myisam/ha_myisam.cc
      storage/myisam/mi_check.c
      storage/myisam/mi_close.c
      storage/myisam/mi_create.c
      storage/myisam/mi_dynrec.c
      storage/myisam/mi_open.c
      storage/myisam/mi_packrec.c
      storage/myisam/mi_preload.c
      storage/myisam/mi_test2.c
      storage/myisam/mi_write.c
      storage/myisam/myisamchk.c
      storage/myisam/myisamlog.c
      storage/myisam/myisampack.c
      storage/myisam/rt_index.c
      storage/myisam/sort.c
      storage/myisammrg/ha_myisammrg.cc
      storage/myisammrg/myrg_close.c
      storage/myisammrg/myrg_open.c
      storage/ndb/config/win-lib.am
      storage/ndb/config/win-prg.am
      storage/ndb/include/util/NdbAutoPtr.hpp
      storage/ndb/src/mgmapi/mgmapi.cpp
      storage/ndb/src/mgmapi/ndb_logevent.cpp
      storage/ndb/test/ndbapi/testIndexStat.cpp
      storage/ndb/tools/restore/consumer_restore.cpp
      storage/perfschema/pfs.cc
      tests/mysql_client_test.c
      tests/thread_test.c
      unittest/mysys/CMakeLists.txt
      unittest/mysys/Makefile.am
      vio/test-ssl.c
      vio/test-sslclient.c
      vio/test-sslserver.c
      vio/vio.c
      vio/viosslfactories.c
      vio/viotest-ssl.c
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh	2010-06-17 13:31:51 +0000
+++ b/BUILD/SETUP.sh	2010-07-08 21:20:08 +0000
@@ -122,13 +122,13 @@ fi
 # Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
 # LINT_INIT(), which is only useful for silencing spurious warnings
 # of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
-valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
+valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
 valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
 valgrind_configs="--with-valgrind"
 #
 # Used in -debug builds
 debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
-debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
+debug_cflags="$debug_cflags -DSAFE_MUTEX"
 error_inject="--with-error-inject "
 #
 # Base C++ flags for all builds

=== modified file 'BUILD/build_mccge.sh'
--- a/BUILD/build_mccge.sh	2010-06-17 13:31:51 +0000
+++ b/BUILD/build_mccge.sh	2010-07-08 21:20:08 +0000
@@ -1010,7 +1010,7 @@ set_ccache_usage()
 set_valgrind_flags()
 {
   if test "x$valgrind_flag" = "xyes" ; then
-    loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
+    loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
     loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
     compiler_flags="$compiler_flags $loc_valgrind_flags"
     with_flags="$with_flags --with-valgrind"
@@ -1066,7 +1066,7 @@ set_with_debug_flags()
   if test "x$with_debug_flag" = "xyes" ; then
     if test "x$developer_flag" = "xyes" ; then
       loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
-      loc_debug_flags="$loc_debug_flags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC"
+      loc_debug_flags="$loc_debug_flags"
       compiler_flags="$compiler_flags $loc_debug_flags"
     fi
   fi

=== modified file 'BUILD/compile-ia64-debug-max'
--- a/BUILD/compile-ia64-debug-max	2007-01-28 20:09:54 +0000
+++ b/BUILD/compile-ia64-debug-max	2010-07-08 21:20:08 +0000
@@ -4,5 +4,5 @@ gmake -k maintainer-clean || true 
 path=`dirname $0`
 . "$path/autorun.sh"
 
-CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static  --with-client-ldflags=-all-static  --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
+CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static  --with-client-ldflags=-all-static  --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
 gmake

=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2010-06-18 15:04:15 +0000
+++ b/CMakeLists.txt	2010-07-08 21:20:08 +0000
@@ -34,7 +34,7 @@ ENDIF()
 SET(CUSTOM_C_FLAGS $ENV{CFLAGS})
 
 OPTION(WITH_DEBUG "Use dbug/safemutex" OFF)
-OPTION(WITH_DEBUG_FULL "Use dbug and safemalloc/safemutex. Slow" OFF)
+OPTION(WITH_DEBUG_FULL "Use dbug and safemutex. Slow." OFF)
 
 # Distinguish between community and non-community builds, with the
 # default being a community build. This does not impact the feature
@@ -175,14 +175,13 @@ IF(NOT CMAKE_BUILD_TYPE
     ENDIF()
 ENDIF()
 
-# Add safemalloc and safemutex for debug condifurations, except on Windows 
-# (C runtime library provides safemalloc functionality and safemutex has never 
-# worked there)
+# Add safemutex for debug configurations, except on Windows
+# (safemutex has never worked on Windows)
 IF(WITH_DEBUG OR WITH_DEBUG_FULL AND NOT WIN32)
   FOREACH(LANG C CXX)
     IF(WITH_DEBUG_FULL)
       SET(CMAKE_${LANG}_FLAGS_DEBUG 
-        "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+        "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
     ELSE()
       SET(CMAKE_${LANG}_FLAGS_DEBUG 
         "${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")

=== modified file 'client/completion_hash.cc'
--- a/client/completion_hash.cc	2007-05-10 09:59:39 +0000
+++ b/client/completion_hash.cc	2010-07-08 21:20:08 +0000
@@ -22,7 +22,6 @@
 
 #include <my_global.h>
 #include <m_string.h>
-#undef SAFEMALLOC				// Speed things up
 #include <my_sys.h>
 #include "completion_hash.h"
 
@@ -213,7 +212,7 @@ void completion_hash_clean(HashTable *ht
 void completion_hash_free(HashTable *ht)
 {
   completion_hash_clean(ht);
-  my_free(ht->arBuckets, MYF(0));
+  my_free(ht->arBuckets);
 }
 
 

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	2010-06-11 01:30:49 +0000
+++ b/client/mysql.cc	2010-07-08 21:20:08 +0000
@@ -1205,7 +1205,7 @@ int main(int argc,char *argv[])
           strncmp(link_name, "/dev/null", 10) == 0)
       {
         /* The .mysql_history file is a symlink to /dev/null, don't use it */
-        my_free(histfile, MYF(MY_ALLOW_ZERO_PTR));
+        my_free(histfile);
         histfile= 0;
       }
     }
@@ -1266,23 +1266,23 @@ sig_handler mysql_end(int sig)
   glob_buffer.free();
   old_buffer.free();
   processed_prompt.free();
-  my_free(server_version,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(histfile,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(current_user,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(full_username,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(part_username,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(server_version);
+  my_free(opt_password);
+  my_free(opt_mysql_unix_port);
+  my_free(histfile);
+  my_free(histfile_tmp);
+  my_free(current_db);
+  my_free(current_host);
+  my_free(current_user);
+  my_free(full_username);
+  my_free(part_username);
+  my_free(default_prompt);
 #ifdef HAVE_SMEM
-  my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(shared_memory_base_name);
 #endif
-  my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(current_prompt);
   while (embedded_server_arg_count > 1)
-    my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
+    my_free(embedded_server_args[--embedded_server_arg_count]);
   mysql_server_end();
   free_defaults(defaults_argv);
   my_end(my_end_arg);
@@ -1736,7 +1736,7 @@ get_one_option(int optid, const struct m
     if (argument)
     {
       char *start= argument;
-      my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(opt_password);
       opt_password= my_strdup(argument, MYF(MY_FAE));
       while (*argument) *argument++= 'x';		// Destroy argument
       if (*start)
@@ -1833,7 +1833,7 @@ static int get_options(int argc, char **
   if (argc == 1)
   {
     skip_updates= 0;
-    my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(current_db);
     current_db= my_strdup(*argv, MYF(MY_WME));
   }
   if (tty_password)
@@ -2731,7 +2731,7 @@ static void get_current_db()
 {
   MYSQL_RES *res;
 
-  my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(current_db);
   current_db= NULL;
   /* In case of error below current_db will be NULL */
   if (!mysql_query(&mysql, "SELECT DATABASE()") &&
@@ -4023,12 +4023,12 @@ com_connect(String *buffer, char *line)
     tmp= get_arg(buff, 0);
     if (tmp && *tmp)
     {
-      my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(current_db);
       current_db= my_strdup(tmp, MYF(MY_WME));
       tmp= get_arg(buff, 1);
       if (tmp)
       {
-	my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
+	my_free(current_host);
 	current_host=my_strdup(tmp,MYF(MY_WME));
       }
     }
@@ -4200,7 +4200,7 @@ com_use(String *buffer __attribute__((un
       if (mysql_select_db(&mysql,tmp))
         return put_error(&mysql);
     }
-    my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(current_db);
     current_db=my_strdup(tmp,MYF(MY_WME));
 #ifdef HAVE_READLINE
     if (select_db > 1)
@@ -4952,8 +4952,8 @@ static void add_int_to_prompt(int toadd)
 
 static void init_username()
 {
-  my_free(full_username,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(part_username,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(full_username);
+  my_free(part_username);
 
   MYSQL_RES *result;
   LINT_INIT(result);
@@ -4971,7 +4971,7 @@ static int com_prompt(String *buffer, ch
 {
   char *ptr=strchr(line, ' ');
   prompt_counter = 0;
-  my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(current_prompt);
   current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME));
   if (!ptr)
     tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt);

=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc	2010-06-11 01:30:49 +0000
+++ b/client/mysqladmin.cc	2010-07-08 21:20:08 +0000
@@ -236,7 +236,7 @@ get_one_option(int optid, const struct m
     if (argument)
     {
       char *start=argument;
-      my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+      my_free(opt_password);
       opt_password=my_strdup(argument,MYF(MY_FAE));
       while (*argument) *argument++= 'x';		/* Destroy argument */
       if (*start)
@@ -448,10 +448,10 @@ int main(int argc,char *argv[])
   }                                             /* got connection */
 
   mysql_close(&mysql);
-  my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(user,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(opt_password);
+  my_free(user);
 #ifdef HAVE_SMEM
-  my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(shared_memory_base_name);
 #endif
   free_defaults(save_argv);
   my_end(my_end_arg);
@@ -1008,8 +1008,8 @@ static int execute_commands(MYSQL *mysql
       /* free up memory from prompted password */
       if (typed_password != argv[1]) 
       {
-        my_free(typed_password,MYF(MY_ALLOW_ZERO_PTR));
-        my_free(verified,MYF(MY_ALLOW_ZERO_PTR));
+        my_free(typed_password);
+        my_free(verified);
       }
       argc--; argv++;
       break;

=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	2010-06-11 01:30:49 +0000
+++ b/client/mysqlbinlog.cc	2010-07-09 11:24:18 +0000
@@ -68,20 +68,20 @@ TYPELIB base64_output_mode_typelib=
   { array_elements(base64_output_mode_names) - 1, "",
     base64_output_mode_names, NULL };
 static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC;
-static const char *opt_base64_output_mode_str= NullS;
-static const char* database= 0;
+static char *opt_base64_output_mode_str= NullS;
+static char* database= 0;
 static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
 static my_bool debug_info_flag, debug_check_flag;
 static my_bool force_if_open_opt= 1;
 static ulonglong offset = 0;
-static const char* host = 0;
+static char* host = 0;
 static int port= 0;
 static uint my_end_arg;
 static const char* sock= 0;
 #ifdef HAVE_SMEM
 static char *shared_memory_base_name= 0;
 #endif
-static const char* user = 0;
+static char* user = 0;
 static char* pass = 0;
 static char *charset= 0;
 
@@ -96,7 +96,7 @@ static my_time_t start_datetime= 0, stop
 static ulonglong rec_count= 0;
 static short binlog_flags = 0; 
 static MYSQL* mysql = NULL;
-static const char* dirname_for_local_load= 0;
+static char* dirname_for_local_load= 0;
 
 /**
   Pointer to the Format_description_log_event of the currently active binlog.
@@ -191,7 +191,7 @@ public:
   int init()
   {
     return init_dynamic_array(&file_names, sizeof(File_name_record),
-			      100,100 CALLER_INFO);
+			      100, 100);
   }
 
   void init_by_dir_name(const char *dir)
@@ -213,7 +213,7 @@ public:
     {
       if (ptr->fname)
       {
-        my_free(ptr->fname, MYF(MY_WME));
+        my_free(ptr->fname);
         delete ptr->event;
         bzero((char *)ptr, sizeof(File_name_record));
       }
@@ -442,7 +442,7 @@ Exit_status Load_log_processor::process_
   {
     error("Could not construct local filename %s%s.",
           target_dir_name,bname);
-    my_free(fname, MYF(0));
+    my_free(fname);
     delete ce;
     DBUG_RETURN(ERROR_STOP);
   }
@@ -458,7 +458,7 @@ Exit_status Load_log_processor::process_
   if (set_dynamic(&file_names, (uchar*)&rec, file_id))
   {
     error("Out of memory.");
-    my_free(fname, MYF(0));
+    my_free(fname);
     delete ce;
     DBUG_RETURN(ERROR_STOP);
   }
@@ -822,7 +822,7 @@ Exit_status process_event(PRINT_EVENT_IN
         */
         convert_path_to_forward_slashes((char*) ce->fname);
 	ce->print(result_file, print_event_info, TRUE);
-	my_free((char*)ce->fname,MYF(MY_WME));
+	my_free((void*)ce->fname);
 	delete ce;
       }
       else
@@ -887,7 +887,7 @@ Exit_status process_event(PRINT_EVENT_IN
       }
 
       if (fname)
-	my_free(fname, MYF(MY_WME));
+	my_free(fname);
       break;
     }
     case TABLE_MAP_EVENT:
@@ -1222,11 +1222,11 @@ static void warning(const char *format,.
 */
 static void cleanup()
 {
-  my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
-  my_free((char*) database, MYF(MY_ALLOW_ZERO_PTR));
-  my_free((char*) host, MYF(MY_ALLOW_ZERO_PTR));
-  my_free((char*) user, MYF(MY_ALLOW_ZERO_PTR));
-  my_free((char*) dirname_for_local_load, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(pass);
+  my_free(database);
+  my_free(host);
+  my_free(user);
+  my_free(dirname_for_local_load);
 
   delete glob_description_event;
   if (mysql)
@@ -1306,7 +1306,7 @@ get_one_option(int optid, const struct m
       argument= (char*) "";                     // Don't require password
     if (argument)
     {
-      my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
+      my_free(pass);
       char *start=argument;
       pass= my_strdup(argument,MYF(MY_FAE));
       while (*argument) *argument++= 'x';		/* Destroy argument */
@@ -2032,6 +2032,7 @@ int main(int argc, char** argv)
   {
     usage();
     free_defaults(defaults_argv);
+    my_end(my_end_arg);
     exit(1);
   }
 

=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c	2010-06-11 01:30:49 +0000
+++ b/client/mysqlcheck.c	2010-07-08 21:20:08 +0000
@@ -291,7 +291,7 @@ get_one_option(int optid, const struct m
     if (argument)
     {
       char *start = argument;
-      my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(opt_password);
       opt_password = my_strdup(argument, MYF(MY_FAE));
       while (*argument) *argument++= 'x';		/* Destroy argument */
       if (*start)
@@ -470,7 +470,7 @@ static int process_selected_tables(char 
     }
     *--end = 0;
     handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1));
-    my_free(table_names_comma_sep, MYF(0));
+    my_free(table_names_comma_sep);
   }
   else
     for (; tables > 0; tables--, table_names++)
@@ -569,7 +569,7 @@ static int process_all_tables_in_db(char
     *--end = 0;
     if (tot_length)
       handle_request_for_tables(tables + 1, tot_length - 1);
-    my_free(tables, MYF(0));
+    my_free(tables);
   }
   else
   {
@@ -727,7 +727,7 @@ static int handle_request_for_tables(cha
     return 1;
   }
   print_result();
-  my_free(query, MYF(0));
+  my_free(query);
   return 0;
 }
 
@@ -899,9 +899,9 @@ int main(int argc, char **argv)
   dbDisconnect(current_host);
   if (opt_auto_repair)
     delete_dynamic(&tables4repair);
-  my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(opt_password);
 #ifdef HAVE_SMEM
-  my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(shared_memory_base_name);
 #endif
   my_end(my_end_arg);
   return(first_error!=0);

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2010-06-11 01:30:49 +0000
+++ b/client/mysqldump.c	2010-07-08 21:20:08 +0000
@@ -715,12 +715,6 @@ static void write_footer(FILE *sql_file)
 } /* write_footer */
 
 
-static void free_table_ent(char *key)
-{
-  my_free(key, MYF(0));
-}
-
-
 uchar* get_table_key(const char *entry, size_t *length,
                      my_bool not_used __attribute__((unused)))
 {
@@ -745,7 +739,7 @@ get_one_option(int optid, const struct m
     if (argument)
     {
       char *start=argument;
-      my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+      my_free(opt_password);
       opt_password=my_strdup(argument,MYF(MY_FAE));
       while (*argument) *argument++= 'x';               /* Destroy argument */
       if (*start)
@@ -905,8 +899,7 @@ static int get_options(int *argc, char *
   defaults_argv= *argv;
 
   if (my_hash_init(&ignore_table, charset_info, 16, 0, 0,
-                   (my_hash_get_key) get_table_key,
-                   (my_hash_free_key) free_table_ent, 0))
+                   (my_hash_get_key) get_table_key, my_free, 0))
     return(EX_EOM);
   /* Don't copy internal log tables */
   if (my_hash_insert(&ignore_table,
@@ -1420,7 +1413,7 @@ static void free_resources()
 {
   if (md_result_file && md_result_file != stdout)
     my_fclose(md_result_file, MYF(0));
-  my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(opt_password);
   if (my_hash_inited(&ignore_table))
     my_hash_free(&ignore_table);
   if (extended_insert)
@@ -1534,7 +1527,7 @@ static void unescape(FILE *file,char *po
   fputs(tmp, file);
   fputc('\'', file);
   check_io(file);
-  my_free(tmp, MYF(MY_WME));
+  my_free(tmp);
   DBUG_VOID_RETURN;
 } /* unescape */
 
@@ -2201,7 +2194,7 @@ static uint dump_routines_for_db(char *d
               }
             }
 
-            my_free(query_str, MYF(MY_ALLOW_ZERO_PTR));
+            my_free(query_str);
           }
         } /* end of routine printing */
         mysql_free_result(routine_res);
@@ -2374,12 +2367,12 @@ static uint get_table_structure(char *ta
           if (mysql_errno(mysql) == ER_VIEW_INVALID)
             fprintf(sql_file, "\n-- failed on view %s: %s\n\n", result_table, scv_buff ? scv_buff : "");
 
-          my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
+          my_free(scv_buff);
 
           DBUG_RETURN(0);
         }
         else
-          my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
+          my_free(scv_buff);
 
         if (mysql_num_rows(result))
         {
@@ -2855,7 +2848,7 @@ static int dump_trigger(FILE *sql_file, 
         DBUG_RETURN(TRUE);
     }
 
-    my_free(query_str, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(query_str);
   }
 
   DBUG_RETURN(FALSE);
@@ -4073,7 +4066,7 @@ static int dump_all_tables_in_db(char *d
     if (include_table((uchar*) hash_key, end - hash_key))
     {
       dump_table(table,database);
-      my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(order_by);
       order_by= 0;
       if (opt_dump_triggers && ! opt_xml &&
           mysql_get_server_version(mysql) >= 50009)
@@ -4345,7 +4338,7 @@ static int dump_selected_tables(char *db
     dump_routines_for_db(db);
   }
   free_root(&root, MYF(0));
-  my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(order_by);
   order_by= 0;
   if (opt_xml)
   {
@@ -5258,7 +5251,7 @@ int main(int argc, char **argv)
     goto err;
 
 #ifdef HAVE_SMEM
-  my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(shared_memory_base_name);
 #endif
   /*
     No reason to explicitely COMMIT the transaction, neither to explicitely

=== modified file 'client/mysqlimport.c'
--- a/client/mysqlimport.c	2010-06-11 01:30:49 +0000
+++ b/client/mysqlimport.c	2010-07-08 21:20:08 +0000
@@ -230,7 +230,7 @@ get_one_option(int optid, const struct m
     if (argument)
     {
       char *start=argument;
-      my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+      my_free(opt_password);
       opt_password=my_strdup(argument,MYF(MY_FAE));
       while (*argument) *argument++= 'x';		/* Destroy argument */
       if (*start)
@@ -684,9 +684,9 @@ int main(int argc, char **argv)
           exitcode= error;
     db_disconnect(current_host, mysql);
   }
-  my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(opt_password);
 #ifdef HAVE_SMEM
-  my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(shared_memory_base_name);
 #endif
   free_defaults(argv_to_free);
   my_end(my_end_arg);

=== modified file 'client/mysqlshow.c'
--- a/client/mysqlshow.c	2010-06-11 01:30:49 +0000
+++ b/client/mysqlshow.c	2010-07-08 21:20:08 +0000
@@ -149,10 +149,9 @@ int main(int argc, char **argv)
     break;
   }
   mysql_close(&mysql);			/* Close & free connection */
-  if (opt_password)
-    my_free(opt_password,MYF(0));
+  my_free(opt_password);
 #ifdef HAVE_SMEM
-  my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(shared_memory_base_name);
 #endif
   my_end(my_end_arg);
   exit(error ? 1 : 0);
@@ -292,7 +291,7 @@ get_one_option(int optid, const struct m
     if (argument)
     {
       char *start=argument;
-      my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
+      my_free(opt_password);
       opt_password=my_strdup(argument,MYF(MY_FAE));
       while (*argument) *argument++= 'x';		/* Destroy argument */
       if (*start)

=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c	2010-06-11 01:30:49 +0000
+++ b/client/mysqlslap.c	2010-07-08 21:20:08 +0000
@@ -399,10 +399,8 @@ int main(int argc, char **argv)
     mysql_close(&mysql); /* Close & free connection */
 
   /* now free all the strings we created */
-  if (opt_password)
-    my_free(opt_password, MYF(0));
-
-  my_free(concurrency, MYF(0));
+  my_free(opt_password);
+  my_free(concurrency);
 
   statement_cleanup(create_statements);
   statement_cleanup(query_statements);
@@ -411,8 +409,7 @@ int main(int argc, char **argv)
   option_cleanup(engine_options);
 
 #ifdef HAVE_SMEM
-  if (shared_memory_base_name)
-    my_free(shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(shared_memory_base_name);
 #endif
   free_defaults(defaults_argv);
   my_end(my_end_arg);
@@ -504,7 +501,7 @@ void concurrency_loop(MYSQL *mysql, uint
   if (opt_csv_str)
     print_conclusions_csv(&conclusion);
 
-  my_free(head_sptr, MYF(0));
+  my_free(head_sptr);
 
 }
 
@@ -721,7 +718,7 @@ get_one_option(int optid, const struct m
     if (argument)
     {
       char *start= argument;
-      my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(opt_password);
       opt_password= my_strdup(argument,MYF(MY_FAE));
       while (*argument) *argument++= 'x';		/* Destroy argument */
       if (*start)
@@ -1367,7 +1364,7 @@ get_options(int *argc,char ***argv)
       tmp_string[sbuf.st_size]= '\0';
       my_close(data_file,MYF(0));
       parse_delimiter(tmp_string, &create_statements, delimiter[0]);
-      my_free(tmp_string, MYF(0));
+      my_free(tmp_string);
     }
     else if (create_string)
     {
@@ -1396,7 +1393,7 @@ get_options(int *argc,char ***argv)
       if (user_supplied_query)
         actual_queries= parse_delimiter(tmp_string, &query_statements,
                                         delimiter[0]);
-      my_free(tmp_string, MYF(0));
+      my_free(tmp_string);
     } 
     else if (user_supplied_query)
     {
@@ -1427,7 +1424,7 @@ get_options(int *argc,char ***argv)
     if (user_supplied_pre_statements)
       (void)parse_delimiter(tmp_string, &pre_statements,
                             delimiter[0]);
-    my_free(tmp_string, MYF(0));
+    my_free(tmp_string);
   } 
   else if (user_supplied_pre_statements)
   {
@@ -1458,7 +1455,7 @@ get_options(int *argc,char ***argv)
     if (user_supplied_post_statements)
       (void)parse_delimiter(tmp_string, &post_statements,
                             delimiter[0]);
-    my_free(tmp_string, MYF(0));
+    my_free(tmp_string);
   } 
   else if (user_supplied_post_statements)
   {
@@ -1555,9 +1552,9 @@ drop_primary_key_list(void)
   if (primary_keys_number_of)
   {
     for (counter= 0; counter < primary_keys_number_of; counter++)
-      my_free(primary_keys[counter], MYF(0));
+      my_free(primary_keys[counter]);
 
-    my_free(primary_keys, MYF(0));
+    my_free(primary_keys);
   }
 
   return 0;
@@ -2154,11 +2151,9 @@ option_cleanup(option_string *stmt)
   for (ptr= stmt; ptr; ptr= nptr)
   {
     nptr= ptr->next;
-    if (ptr->string)
-      my_free(ptr->string, MYF(0)); 
-    if (ptr->option)
-      my_free(ptr->option, MYF(0)); 
-    my_free(ptr, MYF(0));
+    my_free(ptr->string);
+    my_free(ptr->option);
+    my_free(ptr);
   }
 }
 
@@ -2172,9 +2167,8 @@ statement_cleanup(statement *stmt)
   for (ptr= stmt; ptr; ptr= nptr)
   {
     nptr= ptr->next;
-    if (ptr->string)
-      my_free(ptr->string, MYF(0)); 
-    my_free(ptr, MYF(0));
+    my_free(ptr->string);
+    my_free(ptr);
   }
 }
 

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2010-06-11 01:30:49 +0000
+++ b/client/mysqltest.cc	2010-07-09 01:19:57 +0000
@@ -84,10 +84,10 @@ static my_bool get_one_option(int optid,
 C_MODE_END
 
 enum {
-  OPT_SKIP_SAFEMALLOC=OPT_MAX_CLIENT_OPTION,
-  OPT_PS_PROTOCOL, OPT_SP_PROTOCOL, OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL,
-  OPT_MAX_CONNECT_RETRIES, OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS,
-  OPT_LOG_DIR, OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION
+  OPT_PS_PROTOCOL=OPT_MAX_CLIENT_OPTION, OPT_SP_PROTOCOL,
+  OPT_CURSOR_PROTOCOL, OPT_VIEW_PROTOCOL, OPT_MAX_CONNECT_RETRIES,
+  OPT_MAX_CONNECTIONS, OPT_MARK_PROGRESS, OPT_LOG_DIR,
+  OPT_TAIL_LINES, OPT_RESULT_FORMAT_VERSION
 };
 
 static int record= 0, opt_sleep= -1;
@@ -156,7 +156,7 @@ static struct st_block *cur_block, *bloc
 struct st_test_file
 {
   FILE* file;
-  const char *file_name;
+  char *file_name;
   uint lineno; /* Current line in file */
 };
 
@@ -1106,9 +1106,9 @@ void close_connections()
     mysql_close(&next_con->mysql);
     if (next_con->util_mysql)
       mysql_close(next_con->util_mysql);
-    my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(next_con->name);
   }
-  my_free(connections, MYF(MY_WME));
+  my_free(connections);
   DBUG_VOID_RETURN;
 }
 
@@ -1137,7 +1137,7 @@ void close_files()
       DBUG_PRINT("info", ("closing file: %s", cur_file->file_name));
       fclose(cur_file->file);
     }
-    my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(cur_file->file_name);
     cur_file->file_name= 0;
   }
   DBUG_VOID_RETURN;
@@ -1157,22 +1157,22 @@ void free_used_memory()
   for (i= 0 ; i < q_lines.elements ; i++)
   {
     struct st_command **q= dynamic_element(&q_lines, i, struct st_command**);
-    my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR));
+    my_free((*q)->query_buf);
     if ((*q)->content.str)
       dynstr_free(&(*q)->content);
-    my_free((*q),MYF(0));
+    my_free((*q));
   }
   for (i= 0; i < 10; i++)
   {
     if (var_reg[i].alloced_len)
-      my_free(var_reg[i].str_val, MYF(MY_WME));
+      my_free(var_reg[i].str_val);
   }
   while (embedded_server_arg_count > 1)
-    my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
+    my_free(embedded_server_args[--embedded_server_arg_count]);
   delete_dynamic(&q_lines);
   dynstr_free(&ds_res);
   free_all_replace();
-  my_free(opt_pass,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(opt_pass);
   free_defaults(default_argv);
   free_re();
 #ifdef __WIN__
@@ -1933,9 +1933,10 @@ static uchar *get_var_key(const uchar* v
 
 static void var_free(void *v)
 {
-  my_free(((VAR*) v)->str_val, MYF(MY_WME));
-  if (((VAR*)v)->alloced)
-    my_free(v, MYF(MY_WME));
+  VAR *var= (VAR*) v;
+  my_free(var->str_val);
+  if (var->alloced)
+    my_free(var);
 }
 
 C_MODE_END
@@ -4824,7 +4825,7 @@ void do_close_connection(struct st_comma
   con->util_mysql= 0;
   con->pending= FALSE;
   
-  my_free(con->name, MYF(0));
+  my_free(con->name);
 
   /*
     When the connection is closed set name to "-closed_connection-"
@@ -5491,7 +5492,7 @@ int read_line(char *buf, int size)
 	fclose(cur_file->file);
         cur_file->file= 0;
       }
-      my_free((uchar*) cur_file->file_name, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(cur_file->file_name);
       cur_file->file_name= 0;
       if (cur_file == file_stack)
       {
@@ -5967,9 +5968,6 @@ static struct my_option my_long_options[
    0, 0, 0},
   {"silent", 's', "Suppress all normal output. Synonym for --quiet.",
    &silent, &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
-   "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
-   0, 0, 0, 0, 0, 0},
   {"sleep", 'T', "Always sleep this many seconds on sleep commands.",
    &opt_sleep, &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, -1, 0,
    0, 0, 0},
@@ -6125,7 +6123,7 @@ get_one_option(int optid, const struct m
       argument= (char*) "";			// Don't require password
     if (argument)
     {
-      my_free(opt_pass, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(opt_pass);
       opt_pass= my_strdup(argument, MYF(MY_FAE));
       while (*argument) *argument++= 'x';		/* Destroy argument */
       tty_password= 0;
@@ -6158,11 +6156,6 @@ get_one_option(int optid, const struct m
   case 'F':
     read_embedded_server_arguments(argument);
     break;
-  case OPT_SKIP_SAFEMALLOC:
-#ifdef SAFEMALLOC
-    sf_malloc_quick=1;
-#endif
-    break;
   case OPT_RESULT_FORMAT_VERSION:
     set_result_format_version(opt_result_format_version);
     break;
@@ -6321,7 +6314,7 @@ void init_win_path_patterns()
     /* Don't insert zero length strings in patterns array */
     if (strlen(p) == 0)
     {
-      my_free(p, MYF(0));
+      my_free(p);
       continue;
     }
 
@@ -6345,7 +6338,7 @@ void free_win_path_patterns()
   for (i=0 ; i < patterns.elements ; i++)
   {
     const char** pattern= dynamic_element(&patterns, i, const char**);
-    my_free((char*) *pattern, MYF(0));
+    my_free((void *) *pattern);
   }
   delete_dynamic(&patterns);
 }
@@ -6538,12 +6531,12 @@ void append_stmt_result(DYNAMIC_STRING *
   for (i= 0; i < num_fields; i++)
   {
     /* Free data for output */
-    my_free(my_bind[i].buffer, MYF(MY_WME | MY_FAE));
+    my_free(my_bind[i].buffer);
   }
   /* Free array with bind structs, lengths and NULL flags */
-  my_free(my_bind    , MYF(MY_WME | MY_FAE));
-  my_free(length  , MYF(MY_WME | MY_FAE));
-  my_free(is_null , MYF(MY_WME | MY_FAE));
+  my_free(my_bind);
+  my_free(length);
+  my_free(is_null);
 }
 
 
@@ -8489,11 +8482,11 @@ void do_get_replace_column(struct st_com
     if (!*from)
       die("Wrong number of arguments to replace_column in '%s'", command->query);
     to= get_string(&buff, &from, command);
-    my_free(replace_column[column_number-1], MY_ALLOW_ZERO_PTR);
+    my_free(replace_column[column_number-1]);
     replace_column[column_number-1]= my_strdup(to, MYF(MY_WME | MY_FAE));
     set_if_bigger(max_replace_column, column_number);
   }
-  my_free(start, MYF(0));
+  my_free(start);
   command->last_argument= command->end;
 
   DBUG_VOID_RETURN;
@@ -8507,7 +8500,7 @@ void free_replace_column()
   {
     if (replace_column[i])
     {
-      my_free(replace_column[i], 0);
+      my_free(replace_column[i]);
       replace_column[i]= 0;
     }
   }
@@ -8588,7 +8581,7 @@ void do_get_replace(struct st_command *c
     die("Can't initialize replace from '%s'", command->query);
   free_pointer_array(&from_array);
   free_pointer_array(&to_array);
-  my_free(start, MYF(0));
+  my_free(start);
   command->last_argument= command->end;
   DBUG_VOID_RETURN;
 }
@@ -8597,11 +8590,8 @@ void do_get_replace(struct st_command *c
 void free_replace()
 {
   DBUG_ENTER("free_replace");
-  if (glob_replace)
-  {
-    my_free(glob_replace,MYF(0));
-    glob_replace=0;
-  }
+  my_free(glob_replace);
+  glob_replace= NULL;
   DBUG_VOID_RETURN;
 }
 
@@ -8821,7 +8811,7 @@ struct st_replace_regex* init_replace_re
   return res;
 
 err:
-  my_free(res,0);
+  my_free(res);
   die("Error parsing replace_regex \"%s\"", expr);
   return 0;
 }
@@ -8913,9 +8903,9 @@ void free_replace_regex()
   if (glob_replace_regex)
   {
     delete_dynamic(&glob_replace_regex->regex_arr);
-    my_free(glob_replace_regex->even_buf,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(glob_replace_regex->odd_buf,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(glob_replace_regex,MYF(0));
+    my_free(glob_replace_regex->even_buf);
+    my_free(glob_replace_regex->odd_buf);
+    my_free(glob_replace_regex);
     glob_replace_regex=0;
   }
 }
@@ -9110,7 +9100,7 @@ int reg_replace(char** buf_p, int* buf_l
       str_p= str_end;
     }
   }
-  my_free(subs, MYF(0));
+  my_free(subs);
   my_regfree(&r);
   *res_p= 0;
   *buf_p= buf;
@@ -9242,7 +9232,7 @@ REPLACE *init_replace(char * *from, char
   if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
   {
     free_sets(&sets);
-    my_free(found_set,MYF(0));
+    my_free(found_set);
     DBUG_RETURN(0);
   }
 
@@ -9437,9 +9427,9 @@ REPLACE *init_replace(char * *from, char
 	  replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1));
     }
   }
-  my_free(follow,MYF(0));
+  my_free(follow);
   free_sets(&sets);
-  my_free(found_set,MYF(0));
+  my_free(found_set);
   DBUG_PRINT("exit",("Replace table has %d states",sets.count));
   DBUG_RETURN(replace);
 }
@@ -9455,7 +9445,7 @@ int init_sets(REP_SETS *sets,uint states
   if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
 					   SET_MALLOC_HUNC,MYF(MY_WME))))
   {
-    my_free(sets->set,MYF(0));
+    my_free(sets->set);
     return 1;
   }
   return 0;
@@ -9516,8 +9506,8 @@ void free_last_set(REP_SETS *sets)
 
 void free_sets(REP_SETS *sets)
 {
-  my_free(sets->set_buffer,MYF(0));
-  my_free(sets->bit_buffer,MYF(0));
+  my_free(sets->set_buffer);
+  my_free(sets->bit_buffer);
   return;
 }
 
@@ -9657,7 +9647,7 @@ int insert_pointer_name(reg1 POINTER_ARR
     if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
 				     MYF(MY_WME))))
     {
-      my_free((char*) pa->typelib.type_names,MYF(0));
+      my_free(pa->typelib.type_names);
       DBUG_RETURN (-1);
     }
     pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
@@ -9718,9 +9708,9 @@ void free_pointer_array(POINTER_ARRAY *p
   if (pa->typelib.count)
   {
     pa->typelib.count=0;
-    my_free((char*) pa->typelib.type_names,MYF(0));
+    my_free(pa->typelib.type_names);
     pa->typelib.type_names=0;
-    my_free(pa->str,MYF(0));
+    my_free(pa->str);
   }
 } /* free_pointer_array */
 

=== modified file 'client/readline.cc'
--- a/client/readline.cc	2009-09-11 20:26:35 +0000
+++ b/client/readline.cc	2010-07-08 21:20:08 +0000
@@ -35,7 +35,7 @@ LINE_BUFFER *batch_readline_init(ulong m
     return 0;
   if (init_line_buffer(line_buff,my_fileno(file),IO_SIZE,max_size))
   {
-    my_free(line_buff,MYF(0));
+    my_free(line_buff);
     return 0;
   }
   return line_buff;
@@ -63,8 +63,8 @@ void batch_readline_end(LINE_BUFFER *lin
 {
   if (line_buff)
   {
-    my_free(line_buff->buffer,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(line_buff,MYF(0));
+    my_free(line_buff->buffer);
+    my_free(line_buff);
   }
 }
 
@@ -77,7 +77,7 @@ LINE_BUFFER *batch_readline_command(LINE
       return 0;
   if (init_line_buffer_from_string(line_buff,str))
   {
-    my_free(line_buff,MYF(0));
+    my_free(line_buff);
     return 0;
   }
   return line_buff;

=== modified file 'client/sql_string.h'
--- a/client/sql_string.h	2009-11-11 20:19:41 +0000
+++ b/client/sql_string.h	2010-07-08 21:20:08 +0000
@@ -175,7 +175,7 @@ public:
     {
       alloced=0;
       Alloced_length=0;
-      my_free(Ptr,MYF(0));
+      my_free(Ptr);
       Ptr=0;
       str_length=0;				/* Safety */
     }

=== modified file 'cmake/install_macros.cmake'
--- a/cmake/install_macros.cmake	2010-06-18 15:04:15 +0000
+++ b/cmake/install_macros.cmake	2010-06-30 12:10:29 +0000
@@ -250,7 +250,7 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/d
 
 FUNCTION(INSTALL_DEBUG_TARGET target)
  CMAKE_PARSE_ARGUMENTS(ARG
-  "DESTINATION;RENAME"
+  "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT"
   ""
   ${ARGN}
   )
@@ -269,6 +269,9 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
   ELSE()
    STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug"  debug_target_location "${target_location}" )
   ENDIF()
+  IF(NOT ARG_COMPONENT)
+    SET(ARG_COMPONENT DebugBinaries)
+  ENDIF()
   
   # Define permissions
   # For executable files
@@ -305,19 +308,26 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
     ${RENAME_PARAM}
     ${PERMISSIONS_${target_type}}
     CONFIGURATIONS Release RelWithDebInfo
+    COMPONENT ${ARG_COMPONENT}
     OPTIONAL)
 
   IF(MSVC)
     GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT)
     STRING(REPLACE "${ext}" ".pdb"  debug_pdb_target_location "${debug_target_location}" )
-    IF(RENAME_PARAM)
-      STRING(REPLACE "${ext}" ".pdb"  "${ARG_RENAME}" pdb_rename)
-      SET(PDB_RENAME_PARAM RENAME ${pdb_rename})
+    IF (RENAME_PARAM)
+      IF(NOT ARG_PDB_DESTINATION)
+        STRING(REPLACE "${ext}" ".pdb"  "${ARG_RENAME}" pdb_rename)
+        SET(PDB_RENAME_PARAM RENAME "${pdb_rename}")
+      ENDIF()
+    ENDIF()
+    IF(NOT ARG_PDB_DESTINATION)
+      SET(ARG_PDB_DESTINATION "${ARG_DESTINATION}")
     ENDIF()
     INSTALL(FILES ${debug_pdb_target_location}
-      DESTINATION ${ARG_DESTINATION}
-      ${RPDB_RENAME_PARAM}
+      DESTINATION ${ARG_PDB_DESTINATION}
+      ${PDB_RENAME_PARAM}
       CONFIGURATIONS Release RelWithDebInfo
+      COMPONENT ${ARG_COMPONENT}
       OPTIONAL)
   ENDIF()
 ENDFUNCTION()

=== modified file 'configure.in'
--- a/configure.in	2010-06-26 07:43:00 +0000
+++ b/configure.in	2010-07-08 21:20:08 +0000
@@ -1902,8 +1902,8 @@ elif test "$with_debug" = "full"
 then
   # Full debug. Very slow in some cases
   AC_DEFINE([DBUG_ON], [1], [Use libdbug])
-  CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
-  CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
+  CFLAGS="$DEBUG_CFLAGS -DSAFE_MUTEX $CFLAGS"
+  CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX $CXXFLAGS"
 else
   # Optimized version. No debug
   AC_DEFINE([DBUG_OFF], [1], [Don't use libdbug])

=== modified file 'dbug/CMakeLists.txt'
--- a/dbug/CMakeLists.txt	2009-11-24 23:15:47 +0000
+++ b/dbug/CMakeLists.txt	2010-07-08 21:20:08 +0000
@@ -17,6 +17,6 @@ INCLUDE_DIRECTORIES(
   ${CMAKE_SOURCE_DIR}/dbug
   ${CMAKE_SOURCE_DIR}/include 
 )
-SET(DBUG_SOURCES dbug.c sanity.c)
+SET(DBUG_SOURCES dbug.c)
 ADD_CONVENIENCE_LIBRARY(dbug ${DBUG_SOURCES})
 TARGET_LINK_LIBRARIES(dbug mysys)

=== modified file 'dbug/Makefile.am'
--- a/dbug/Makefile.am	2009-10-30 18:13:58 +0000
+++ b/dbug/Makefile.am	2010-07-08 21:20:08 +0000
@@ -19,7 +19,7 @@ INCLUDES =              -I$(top_builddir
 LDADD =                 libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a
 pkglib_LIBRARIES =      libdbug.a
 noinst_HEADERS =        dbug_long.h
-libdbug_a_SOURCES =     dbug.c sanity.c
+libdbug_a_SOURCES =     dbug.c
 EXTRA_DIST =            CMakeLists.txt example1.c example2.c example3.c \
                         user.r monty.doc dbug_add_tags.pl \
                         my_main.c main.c factorial.c dbug_analyze.c \

=== modified file 'dbug/dbug.c'
--- a/dbug/dbug.c	2010-05-24 18:57:25 +0000
+++ b/dbug/dbug.c	2010-07-08 21:20:08 +0000
@@ -128,9 +128,8 @@
 #define PROFILE_ON      (1 <<  7)  /* Print out profiling code */
 #define PID_ON          (1 <<  8)  /* Identify each line with process id */
 #define TIMESTAMP_ON    (1 <<  9)  /* timestamp every line of output */
-#define SANITY_CHECK_ON (1 << 10)  /* Check safemalloc on DBUG_ENTER */
-#define FLUSH_ON_WRITE  (1 << 11)  /* Flush on every write */
-#define OPEN_APPEND     (1 << 12)  /* Open for append      */
+#define FLUSH_ON_WRITE  (1 << 10)  /* Flush on every write */
+#define OPEN_APPEND     (1 << 11)  /* Open for append      */
 #define TRACE_ON        ((uint)1 << 31)  /* Trace enabled. MUST be the highest bit!*/
 
 #define TRACING (cs->stack->flags & TRACE_ON)
@@ -184,12 +183,6 @@
 static void perror();          /* Fake system/library error print routine */
 #endif
 
-#ifdef SAFEMALLOC
-IMPORT int _sanity(const char *file,uint line); /* safemalloc sanity checker */
-#else
-#define _sanity(X,Y) (1)
-#endif
-
 /*
  *      The user may specify a list of functions to trace or
  *      debug.  These lists are kept in a linear linked list,
@@ -705,12 +698,6 @@ int DbugParse(CODE_STATE *cs, const char
       else
         stack->flags |= TIMESTAMP_ON;
       break;
-    case 'S':
-      if (sign < 0)
-        stack->flags &= ~SANITY_CHECK_ON;
-      else
-        stack->flags |= SANITY_CHECK_ON;
-      break;
     }
     if (!*end)
       break;
@@ -1069,7 +1056,6 @@ int _db_explain_ (CODE_STATE *cs, char *
   op_bool_to_buf('r', cs->stack->sub_level != 0);
   op_intf_to_buf('t', cs->stack->maxdepth, MAXDEPTH, TRACING);
   op_bool_to_buf('T', cs->stack->flags & TIMESTAMP_ON);
-  op_bool_to_buf('S', cs->stack->flags & SANITY_CHECK_ON);
 
   *buf= '\0';
   return 0;
@@ -1187,8 +1173,6 @@ void _db_enter_(const char *_func_, cons
     if (!TRACING) break;
     /* fall through */
   case DO_TRACE:
-    if ((cs->stack->flags & SANITY_CHECK_ON) && _sanity(_file_,_line_))
-      cs->stack->flags &= ~SANITY_CHECK_ON;
     if (TRACING)
     {
       if (!cs->locked)
@@ -1247,9 +1231,6 @@ void _db_return_(uint _line_, struct _db
 #endif
   if (DoTrace(cs) & DO_TRACE)
   {
-    if ((cs->stack->flags & SANITY_CHECK_ON) &&
-        _sanity(_stack_frame_->file,_line_))
-      cs->stack->flags &= ~SANITY_CHECK_ON;
     if (TRACING)
     {
       if (!cs->locked)

=== removed file 'dbug/sanity.c'
--- a/dbug/sanity.c	2001-09-13 23:54:33 +0000
+++ b/dbug/sanity.c	1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-/* Declarate _sanity() if not declared in main program */
-
-#include <my_global.h>
-
-extern int _sanity(const char *file,uint line);
-
-#if defined(SAFEMALLOC) && !defined(MASTER)	/* Avoid errors in MySQL */
-int _sanity(const char * file __attribute__((unused)),
-            uint line __attribute__((unused)))
-{
-  return 0;
-}
-#endif

=== modified file 'dbug/user.r'
--- a/dbug/user.r	2009-10-30 18:13:58 +0000
+++ b/dbug/user.r	2010-07-08 21:20:08 +0000
@@ -1019,14 +1019,6 @@ Most useful with 
 .B DBUG_PUSH 
 macros used to temporarily alter the
 debugger state.
-.LI S
-When compiled with
-.I safemalloc
-this flag forces "sanity" memory checks (for overwrites/underwrites)
-on each
-.B DBUG_ENTER
-and
-.B DBUG_RETURN.
 .LI t[,N]
 Enable function control flow tracing.
 The maximum nesting depth is specified by N, and defaults to

=== modified file 'extra/comp_err.c'
--- a/extra/comp_err.c	2010-06-11 01:30:49 +0000
+++ b/extra/comp_err.c	2010-07-08 21:20:08 +0000
@@ -387,15 +387,15 @@ static void clean_up(struct languages *l
   struct errors *tmp_error, *next_error;
   uint count, i;
 
-  my_free((uchar*) default_language, MYF(0));
+  my_free((void*) default_language);
 
   for (tmp_lang= lang_head; tmp_lang; tmp_lang= next_language)
   {
     next_language= tmp_lang->next_lang;
-    my_free(tmp_lang->lang_short_name, MYF(0));
-    my_free(tmp_lang->lang_long_name, MYF(0));
-    my_free(tmp_lang->charset, MYF(0));
-    my_free((uchar*) tmp_lang, MYF(0));
+    my_free(tmp_lang->lang_short_name);
+    my_free(tmp_lang->lang_long_name);
+    my_free(tmp_lang->charset);
+    my_free(tmp_lang);
   }
 
   for (tmp_error= error_head; tmp_error; tmp_error= next_error)
@@ -406,17 +406,17 @@ static void clean_up(struct languages *l
     {
       struct message *tmp;
       tmp= dynamic_element(&tmp_error->msg, i, struct message*);
-      my_free((uchar*) tmp->lang_short_name, MYF(0));
-      my_free((uchar*) tmp->text, MYF(0));
+      my_free(tmp->lang_short_name);
+      my_free(tmp->text);
     }
 
     delete_dynamic(&tmp_error->msg);
     if (tmp_error->sql_code1[0])
-      my_free((uchar*) tmp_error->sql_code1, MYF(0));
+      my_free((void*) tmp_error->sql_code1);
     if (tmp_error->sql_code2[0])
-      my_free((uchar*) tmp_error->sql_code2, MYF(0));
-    my_free((uchar*) tmp_error->er_name, MYF(0));
-    my_free((uchar*) tmp_error, MYF(0));
+      my_free((void*) tmp_error->sql_code2);
+    my_free((void*) tmp_error->er_name);
+    my_free(tmp_error);
   }
 }
 
@@ -559,7 +559,7 @@ static uint parse_error_offset(char *str
 
   end= 0;
   ioffset= (uint) my_strtoll10(soffset, &end, &error);
-  my_free((uchar*) soffset, MYF(0));
+  my_free(soffset);
   DBUG_RETURN(ioffset);
 }
 

=== modified file 'extra/my_print_defaults.c'
--- a/extra/my_print_defaults.c	2010-06-11 01:30:49 +0000
+++ b/extra/my_print_defaults.c	2010-07-08 21:20:08 +0000
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
   for (argument= arguments+1 ; *argument ; argument++)
     if (*argument != args_separator)           /* skip arguments separator */
       puts(*argument);
-  my_free((char*) load_default_groups,MYF(0));
+  my_free(load_default_groups);
   free_defaults(arguments);
 
   exit(0);

=== modified file 'extra/replace.c'
--- a/extra/replace.c	2009-11-24 13:54:59 +0000
+++ b/extra/replace.c	2010-07-08 21:20:08 +0000
@@ -262,7 +262,7 @@ static int insert_pointer_name(reg1 POIN
     if (!(pa->str= (uchar*) my_malloc((uint) (PS_MALLOC-MALLOC_OVERHEAD),
 				     MYF(MY_WME))))
     {
-      my_free((uchar*) pa->typelib.type_names,MYF(0));
+      my_free(pa->typelib.type_names);
       DBUG_RETURN (-1);
     }
     pa->max_count=(PC_MALLOC-MALLOC_OVERHEAD)/(sizeof(uchar*)+
@@ -324,9 +324,9 @@ static void free_pointer_array(reg1 POIN
   if (pa->typelib.count)
   {
     pa->typelib.count=0;
-    my_free((uchar*) pa->typelib.type_names,MYF(0));
+    my_free(pa->typelib.type_names);
     pa->typelib.type_names=0;
-    my_free((uchar*) pa->str,MYF(0));
+    my_free(pa->str);
   }
   return;
 } /* free_pointer_array */
@@ -441,7 +441,7 @@ static REPLACE *init_replace(char * *fro
   if (!(follow=(FOLLOWS*) my_malloc((states+2)*sizeof(FOLLOWS),MYF(MY_WME))))
   {
     free_sets(&sets);
-    my_free((uchar*) found_set,MYF(0));
+    my_free(found_set);
     DBUG_RETURN(0);
   }
 
@@ -663,9 +663,9 @@ static REPLACE *init_replace(char * *fro
 	  replace[i].next[j]=(REPLACE*) (rep_str+(-sets.set[i].next[j]-1));
     }
   }
-  my_free((uchar*) follow,MYF(0));
+  my_free(follow);
   free_sets(&sets);
-  my_free((uchar*) found_set,MYF(0));
+  my_free(found_set);
   DBUG_PRINT("exit",("Replace table has %d states",sets.count));
   DBUG_RETURN(replace);
 }
@@ -681,7 +681,7 @@ static int init_sets(REP_SETS *sets,uint
   if (!(sets->bit_buffer=(uint*) my_malloc(sizeof(uint)*sets->size_of_bits*
 					   SET_MALLOC_HUNC,MYF(MY_WME))))
   {
-    my_free((uchar*) sets->set,MYF(0));
+    my_free(sets->set);
     return 1;
   }
   return 0;
@@ -742,8 +742,8 @@ static void free_last_set(REP_SETS *sets
 
 static void free_sets(REP_SETS *sets)
 {
-  my_free((uchar*)sets->set_buffer,MYF(0));
-  my_free((uchar*)sets->bit_buffer,MYF(0));
+  my_free(sets->set_buffer);
+  my_free(sets->bit_buffer);
   return;
 }
 
@@ -950,8 +950,8 @@ static void reset_buffer()
 
 static void free_buffer()
 {
-  my_free(buffer,MYF(MY_WME));
-  my_free(out_buff,MYF(MY_WME));
+  my_free(buffer);
+  my_free(out_buff);
 }
 
 

=== modified file 'include/hash.h'
--- a/include/hash.h	2010-03-31 14:05:33 +0000
+++ b/include/hash.h	2010-07-08 21:20:08 +0000
@@ -64,14 +64,14 @@ typedef struct st_hash {
 typedef uint HASH_SEARCH_STATE;
 
 #define my_hash_init(A,B,C,D,E,F,G,H) \
-          _my_hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO)
+          _my_hash_init(A,0,B,C,D,E,F,G,H)
 #define my_hash_init2(A,B,C,D,E,F,G,H,I) \
-          _my_hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO)
+          _my_hash_init(A,B,C,D,E,F,G,H,I)
 my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
                       ulong default_array_elements, size_t key_offset,
                       size_t key_length, my_hash_get_key get_key,
                       void (*free_element)(void*),
-                      uint flags CALLER_INFO_PROTO);
+                      uint flags);
 void my_hash_free(HASH *tree);
 void my_hash_reset(HASH *hash);
 uchar *my_hash_element(HASH *hash, ulong idx);
@@ -100,7 +100,7 @@ my_bool my_hash_check(HASH *hash); /* On
 #define my_hash_clear(H) bzero((char*) (H), sizeof(*(H)))
 #define my_hash_inited(H) ((H)->blength != 0)
 #define my_hash_init_opt(A,B,C,D,E,F,G,H) \
-          (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO))
+          (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G,H))
 
 #ifdef	__cplusplus
 }

=== modified file 'include/lf.h'
--- a/include/lf.h	2009-11-18 02:31:40 +0000
+++ b/include/lf.h	2010-07-08 21:20:08 +0000
@@ -204,7 +204,7 @@ uint lf_alloc_pool_count(LF_ALLOCATOR *a
 #define lf_alloc_get_pins(A)           lf_pinbox_get_pins(&(A)->pinbox)
 #define _lf_alloc_put_pins(PINS)      _lf_pinbox_put_pins(PINS)
 #define lf_alloc_put_pins(PINS)        lf_pinbox_put_pins(PINS)
-#define lf_alloc_direct_free(ALLOC, ADDR) my_free((uchar*)(ADDR), MYF(0))
+#define lf_alloc_direct_free(ALLOC, ADDR) my_free((ADDR))
 
 lock_wrap(lf_alloc_new, void *,
           (LF_PINS *pins),

=== modified file 'include/my_global.h'
--- a/include/my_global.h	2010-06-07 08:47:04 +0000
+++ b/include/my_global.h	2010-07-08 21:20:08 +0000
@@ -889,11 +889,8 @@ typedef SOCKET_SIZE_TYPE size_socket;
   How much overhead does malloc have. The code often allocates
   something like 1024-MALLOC_OVERHEAD bytes
 */
-#ifdef SAFEMALLOC
-#define MALLOC_OVERHEAD (8+24+4)
-#else
 #define MALLOC_OVERHEAD 8
-#endif
+
 	/* get memory in huncs */
 #define ONCE_ALLOC_INIT		(uint) (4096-MALLOC_OVERHEAD)
 	/* Typical record cash */
@@ -1712,11 +1709,6 @@ inline void  operator delete[](void*, vo
 #define min(a, b)	((a) < (b) ? (a) : (b))
 #endif  
 
-#define x_free(A) \
-  do { my_free((uchar*)(A), MYF(MY_WME|MY_FAE|MY_ALLOW_ZERO_PTR)); } while (0)
-#define safeFree(X) \
-    do { if (X) { my_free((uchar*)(X), MYF(0)); (X) = NULL; } } while (0)
-
 /*
   Only Linux is known to need an explicit sync of the directory to make sure a
   file creation/deletion/renaming in(from,to) this directory durable.

=== modified file 'include/my_list.h'
--- a/include/my_list.h	2007-05-10 09:59:39 +0000
+++ b/include/my_list.h	2010-07-08 21:20:08 +0000
@@ -37,7 +37,7 @@ extern int list_walk(LIST *,list_walk_ac
 
 #define list_rest(a) ((a)->next)
 #define list_push(a,b) (a)=list_cons((b),(a))
-#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((unsigned char *) old,MYF(MY_FAE)); }
+#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old); my_free(old); }
 
 #ifdef	__cplusplus
 }

=== modified file 'include/my_nosys.h'
--- a/include/my_nosys.h	2007-05-10 09:59:39 +0000
+++ b/include/my_nosys.h	2010-07-08 21:20:08 +0000
@@ -39,7 +39,7 @@ extern size_t my_quick_read(File Filedes
                             myf myFlags);
 extern size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count);
 
-#if !defined(SAFEMALLOC) && defined(USE_HALLOC)
+#if defined(USE_HALLOC)
 #define my_malloc(a,b) halloc(a,1)
 #define my_no_flags_free(a) hfree(a)
 #endif

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2010-06-08 23:44:25 +0000
+++ b/include/my_sys.h	2010-07-08 21:20:08 +0000
@@ -158,46 +158,15 @@ extern int NEAR my_errno;		/* Last error
 #define GETDATE_FIXEDLENGTH	16
 
 	/* defines when allocating data */
-#ifdef SAFEMALLOC
-#define my_malloc(SZ,FLAG) _mymalloc((SZ), __FILE__, __LINE__, FLAG )
-#define my_malloc_ci(SZ,FLAG) _mymalloc((SZ), sFile, uLine, FLAG )
-#define my_realloc(PTR,SZ,FLAG) _myrealloc((PTR), (SZ), __FILE__, __LINE__, FLAG )
-#define my_checkmalloc() _sanity( __FILE__, __LINE__ )
-#define my_free(PTR,FLAG) _myfree((PTR), __FILE__, __LINE__,FLAG)
-#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
-#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
-#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C)
-#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0)
-#define QUICK_SAFEMALLOC sf_malloc_quick=1
-#define NORMAL_SAFEMALLOC sf_malloc_quick=0
-extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
-extern ulonglong sf_malloc_mem_limit;
-
-#define CALLER_INFO_PROTO   , const char *sFile, uint uLine
-#define CALLER_INFO         , __FILE__, __LINE__
-#define ORIG_CALLER_INFO    , sFile, uLine
-#else
-#define my_checkmalloc()
-#undef TERMINATE
-#define TERMINATE(A,B) {}
-#define QUICK_SAFEMALLOC
-#define NORMAL_SAFEMALLOC
 extern void *my_malloc(size_t Size,myf MyFlags);
-#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG )
+extern void *my_multi_malloc(myf MyFlags, ...);
 extern void *my_realloc(void *oldpoint, size_t Size, myf MyFlags);
-extern void my_no_flags_free(void *ptr);
+extern void my_free(void *ptr);
 extern void *my_memdup(const void *from,size_t length,myf MyFlags);
 extern char *my_strdup(const char *from,myf MyFlags);
 extern char *my_strndup(const char *from, size_t length,
 				   myf MyFlags);
-/* we do use FG (as a no-op) in below so that a typo on FG is caught */
-#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
-#define CALLER_INFO_PROTO   /* nothing */
-#define CALLER_INFO         /* nothing */
-#define ORIG_CALLER_INFO    /* nothing */
 #define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0)
-#endif
-
 #if defined(ENABLED_DEBUG_SYNC)
 extern void (*debug_sync_C_callback_ptr)(const char *, size_t);
 #define DEBUG_SYNC_C(_sync_point_name_) do {                            \
@@ -211,11 +180,11 @@ extern void (*debug_sync_C_callback_ptr)
 #ifdef HAVE_LARGE_PAGES
 extern uint my_get_large_page_size(void);
 extern uchar * my_large_malloc(size_t size, myf my_flags);
-extern void my_large_free(uchar * ptr, myf my_flags);
+extern void my_large_free(uchar *ptr);
 #else
 #define my_get_large_page_size() (0)
 #define my_large_malloc(A,B) my_malloc_lock((A),(B))
-#define my_large_free(A,B) my_free_lock((A),(B))
+#define my_large_free(A) my_free_lock((A))
 #endif /* HAVE_LARGE_PAGES */
 
 #ifdef HAVE_ALLOCA
@@ -233,7 +202,7 @@ extern void my_large_free(uchar * ptr, m
 #define my_afree(PTR) {}
 #else
 #define my_alloca(SZ) my_malloc(SZ,MYF(0))
-#define my_afree(PTR) my_free(PTR,MYF(MY_WME))
+#define my_afree(PTR) my_free(PTR)
 #endif /* HAVE_ALLOCA */
 
 #ifndef errno				/* did we already get it? */
@@ -642,20 +611,6 @@ extern size_t my_fwrite(FILE *stream,con
 		      myf MyFlags);
 extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
 extern my_off_t my_ftell(FILE *stream,myf MyFlags);
-extern void *_mymalloc(size_t uSize,const char *sFile,
-                       uint uLine, myf MyFlag);
-extern void *_myrealloc(void *pPtr,size_t uSize,const char *sFile,
-		       uint uLine, myf MyFlag);
-extern void * my_multi_malloc _VARARGS((myf MyFlags, ...));
-extern void _myfree(void *pPtr,const char *sFile,uint uLine, myf MyFlag);
-extern int _sanity(const char *sFile, uint uLine);
-extern void *_my_memdup(const void *from, size_t length,
-                        const char *sFile, uint uLine,myf MyFlag);
-extern char * _my_strdup(const char *from, const char *sFile, uint uLine,
-                         myf MyFlag);
-extern char *_my_strndup(const char *from, size_t length,
-                         const char *sFile, uint uLine,
-                         myf MyFlag);
 
 /* implemented in my_memmem.c */
 extern void *my_memmem(const void *haystack, size_t haystacklen,
@@ -684,9 +639,6 @@ extern HANDLE   my_get_osfhandle(File fd
 extern void     my_osmaperr(unsigned long last_error);
 #endif
 
-#ifndef TERMINATE
-extern void TERMINATE(FILE *file, uint flag);
-#endif
 extern void init_glob_errs(void);
 extern const char** get_global_errmsgs();
 extern void wait_for_free_space(const char *filename, int errors);
@@ -835,18 +787,16 @@ extern my_bool real_open_cached_file(IO_
 extern void close_cached_file(IO_CACHE *cache);
 File create_temp_file(char *to, const char *dir, const char *pfx,
 		      int mode, myf MyFlags);
-#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D CALLER_INFO)
-#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D ORIG_CALLER_INFO)
-#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E CALLER_INFO)
-#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E ORIG_CALLER_INFO)
-extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array,uint element_size,
-                                   void *init_buffer, uint init_alloc, 
-                                   uint alloc_increment
-                                   CALLER_INFO_PROTO);
+#define my_init_dynamic_array(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
+#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array2(A,B,NULL,C,D)
+#define my_init_dynamic_array2(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
+#define my_init_dynamic_array2_ci(A,B,C,D,E) init_dynamic_array2(A,B,C,D,E)
+extern my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
+                                   void *init_buffer, uint init_alloc,
+                                   uint alloc_increment);
 /* init_dynamic_array() function is deprecated */
-extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
-                                  uint init_alloc,uint alloc_increment
-                                  CALLER_INFO_PROTO);
+extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
+                                  uint init_alloc, uint alloc_increment);
 extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,uchar * element);
 extern uchar *alloc_dynamic(DYNAMIC_ARRAY *array);
 extern uchar *pop_dynamic(DYNAMIC_ARRAY*);
@@ -876,10 +826,10 @@ extern my_bool dynstr_trunc(DYNAMIC_STRI
 extern void dynstr_free(DYNAMIC_STRING *str);
 #ifdef HAVE_MLOCK
 extern void *my_malloc_lock(size_t length,myf flags);
-extern void my_free_lock(void *ptr,myf flags);
+extern void my_free_lock(void *ptr);
 #else
 #define my_malloc_lock(A,B) my_malloc((A),(B))
-#define my_free_lock(A,B) my_free((A),(B))
+#define my_free_lock(A) my_free((A))
 #endif
 #define alloc_root_inited(A) ((A)->min_malloc != 0)
 #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8)

=== modified file 'include/mysql.h.pp'
--- a/include/mysql.h.pp	2010-06-05 19:39:03 +0000
+++ b/include/mysql.h.pp	2010-07-05 21:00:56 +0000
@@ -233,10 +233,10 @@ extern void make_type(char *to,unsigned 
 extern const char *get_type(TYPELIB *typelib,unsigned int nr);
 extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
 extern TYPELIB sql_protocol_typelib;
-my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
+my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
                               my_ulonglong cur_set, my_ulonglong default_set,
-                              const char *str, uint length,
-                              char **err_pos, uint *err_len);
+                              const char *str, unsigned int length,
+                              char **err_pos, unsigned int *err_len);
 typedef struct st_mysql_rows {
   struct st_mysql_rows *next;
   MYSQL_ROW data;

=== modified file 'include/mysql/psi/mysql_file.h'
--- a/include/mysql/psi/mysql_file.h	2010-03-31 14:05:33 +0000
+++ b/include/mysql/psi/mysql_file.h	2010-07-08 21:20:08 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
 
 #ifndef MYSQL_FILE_H
 #define MYSQL_FILE_H
@@ -800,7 +800,7 @@ inline_mysql_file_fopen(
 #endif
       if (unlikely(that->m_file == NULL))
       {
-        my_free(that, MYF(0));
+        my_free(that);
         return NULL;
       }
     }
@@ -834,7 +834,7 @@ inline_mysql_file_fclose(
     if (likely(locker != NULL))
       PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
-    my_free(file, MYF(0));
+    my_free(file);
   }
   return result;
 }

=== modified file 'include/mysql/psi/mysql_thread.h'
--- a/include/mysql/psi/mysql_thread.h	2010-03-09 18:03:02 +0000
+++ b/include/mysql/psi/mysql_thread.h	2010-07-08 17:04:07 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
 
 #ifndef MYSQL_THREAD_H
 #define MYSQL_THREAD_H

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2010-01-26 23:42:54 +0000
+++ b/include/mysql/psi/psi.h	2010-07-08 17:04:07 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 Sun Microsystems, Inc
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
 
 #ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
 #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H

=== modified file 'include/mysql/psi/psi_abi_v1.h'
--- a/include/mysql/psi/psi_abi_v1.h	2009-12-01 00:49:15 +0000
+++ b/include/mysql/psi/psi_abi_v1.h	2010-07-08 17:04:07 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
 
 /**
   @file mysql/psi/psi_abi_v1.h

=== modified file 'include/mysql/psi/psi_abi_v2.h'
--- a/include/mysql/psi/psi_abi_v2.h	2009-12-01 00:49:15 +0000
+++ b/include/mysql/psi/psi_abi_v2.h	2010-07-08 17:04:07 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -10,8 +10,8 @@
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
 
 /**
   @file mysql/psi/psi_abi_v1.h

=== modified file 'include/typelib.h'
--- a/include/typelib.h	2009-12-22 09:35:56 +0000
+++ b/include/typelib.h	2010-07-05 16:20:46 +0000
@@ -36,9 +36,9 @@ extern TYPELIB *copy_typelib(MEM_ROOT *r
 
 extern TYPELIB sql_protocol_typelib;
 
-my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
+my_ulonglong find_set_from_flags(const TYPELIB *lib, unsigned int default_name,
                               my_ulonglong cur_set, my_ulonglong default_set,
-                              const char *str, uint length,
-                              char **err_pos, uint *err_len);
+                              const char *str, unsigned int length,
+                              char **err_pos, unsigned int *err_len);
 
 #endif /* _typelib_h */

=== modified file 'libmysql/Makefile.am'
--- a/libmysql/Makefile.am	2010-05-19 13:00:23 +0000
+++ b/libmysql/Makefile.am	2010-07-08 21:20:08 +0000
@@ -79,7 +79,7 @@ link_sources:
 # a minimal MySQL client library
 #
 # For a really minimal distribution (without debugging code) we could
-# keep only the stubs for safemalloc.c and debug.c
+# keep only the stubs for debug.c
 #
 # A list of needed headers collected from the deps information 000213
 nh =		my_global.h config-win32.h dbug.h errmsg.h \

=== modified file 'libmysql/Makefile.shared'
--- a/libmysql/Makefile.shared	2010-05-31 12:27:10 +0000
+++ b/libmysql/Makefile.shared	2010-07-09 11:18:36 +0000
@@ -49,15 +49,15 @@ mystringsobjects =	strmov.lo strxmov.lo 
 			ctype-uca.lo xml.lo my_strtoll10.lo str_alloc.lo dtoa.lo
 
 mystringsextra= 	strto.c
-dbugobjects =		dbug.lo # IT IS IN SAFEMALLOC.C sanity.lo
+dbugobjects =		dbug.lo
 mysysheaders =		mysys_priv.h my_static.h
 vioheaders =		vio_priv.h
-mysysobjects1 =		my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
+mysysobjects1 =		my_init.lo my_static.lo my_malloc.lo \
 			my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \
 			my_file.lo my_read.lo my_write.lo errors.lo \
 			my_error.lo my_getwd.lo my_div.lo \
 			mf_pack.lo my_mess.lo mf_dirname.lo mf_fn_ext.lo\
-			mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \
+			mf_wcomp.lo typelib.lo my_alloc.lo \
 			mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \
 			my_symlink.lo my_fstream.lo mf_arr_appstr.lo \
 			mf_loadpath.lo my_pthread.lo my_thr_init.lo \

=== modified file 'libmysql/libmysql.c'
--- a/libmysql/libmysql.c	2010-04-11 06:52:42 +0000
+++ b/libmysql/libmysql.c	2010-07-08 21:20:08 +0000
@@ -341,7 +341,7 @@ mysql_connect(MYSQL *mysql,const char *h
     if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0)))
     {
       if (mysql->free_me)
-	my_free((uchar*) mysql,MYF(0));
+	my_free(mysql);
     }
     mysql->reconnect= 1;
     DBUG_RETURN(res);
@@ -457,9 +457,9 @@ my_bool	STDCALL mysql_change_user(MYSQL 
   if (rc == 0)
   {
     /* Free old connect information */
-    my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mysql->user);
+    my_free(mysql->passwd);
+    my_free(mysql->db);
 
     /* alloc new connect information */
     mysql->user=  my_strdup(user,MYF(MY_WME));
@@ -604,7 +604,7 @@ my_bool handle_local_infile(MYSQL *mysql
 err:
   /* free up memory allocated with _init, usually */
   (*options->local_infile_end)(li_ptr);
-  my_free(buf, MYF(0));
+  my_free(buf);
   DBUG_RETURN(result);
 }
 
@@ -715,7 +715,7 @@ static void default_local_infile_end(voi
   {
     if (data->fd >= 0)
       my_close(data->fd, MYF(MY_WME));
-    my_free(ptr, MYF(MY_WME));
+    my_free(ptr);
   }
 }
 
@@ -2206,7 +2206,7 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
     }
     result= execute(stmt, param_data, length);
     stmt->send_types_to_server=0;
-    my_free(param_data, MYF(MY_WME));
+    my_free(param_data);
     DBUG_RETURN(result);
   }
   DBUG_RETURN((int) execute(stmt,0,0));
@@ -4707,7 +4707,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_S
     }
   }
 
-  my_free((uchar*) stmt, MYF(MY_WME));
+  my_free(stmt);
 
   DBUG_RETURN(test(rc));
 }

=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	2010-06-10 11:43:32 +0000
+++ b/libmysqld/lib_sql.cc	2010-07-08 21:20:08 +0000
@@ -76,7 +76,7 @@ void embedded_get_error(MYSQL *mysql, MY
   strmake(net->last_error, ei->info, sizeof(net->last_error)-1);
   memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate));
   mysql->server_status= ei->server_status;
-  my_free(data, MYF(0));
+  my_free(data);
 }
 
 static my_bool
@@ -207,7 +207,7 @@ static MYSQL_FIELD *emb_list_fields(MYSQ
   res= ((THD*) mysql->thd)->cur_data;
   ((THD*) mysql->thd)->cur_data= 0;
   mysql->field_alloc= res->alloc;
-  my_free(res,MYF(0));
+  my_free(res);
   mysql->status= MYSQL_STATUS_READY;
   return mysql->fields;
 }
@@ -236,7 +236,7 @@ static my_bool emb_read_prepare_result(M
     stmt->fields= mysql->fields;
     stmt->mem_root= res->alloc;
     mysql->fields= NULL;
-    my_free(res,MYF(0));
+    my_free(res);
   }
 
   return 0;
@@ -293,7 +293,7 @@ static my_bool emb_read_query_result(MYS
     thd->cur_data= res;
   }
   else
-    my_free(res, MYF(0));
+    my_free(res);
 
   return 0;
 }
@@ -335,7 +335,7 @@ int emb_read_binary_rows(MYSQL_STMT *stm
     return 1;
   }
   stmt->result= *data;
-  my_free((char *) data, MYF(0));
+  my_free(data);
   set_stmt_errmsg(stmt, &stmt->mysql->net);
   return 0;
 }
@@ -590,7 +590,7 @@ int init_embedded_server(int argc, char 
 
 void end_embedded_server()
 {
-  my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(copy_arguments_ptr);
   copy_arguments_ptr=0;
   clean_up(0);
 }

=== modified file 'libmysqld/libmysqld.c'
--- a/libmysqld/libmysqld.c	2010-03-31 14:05:33 +0000
+++ b/libmysqld/libmysqld.c	2010-07-08 21:20:08 +0000
@@ -119,8 +119,8 @@ mysql_real_connect(MYSQL *mysql,const ch
 			       (mysql->options.my_cnf_file ?
 				mysql->options.my_cnf_file : "my"),
 			       mysql->options.my_cnf_group);
-    my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mysql->options.my_cnf_file);
+    my_free(mysql->options.my_cnf_group);
     mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
   }
 

=== modified file 'mysql-test/extra/binlog_tests/drop_temp_table.test'
--- a/mysql-test/extra/binlog_tests/drop_temp_table.test	2010-02-26 13:16:46 +0000
+++ b/mysql-test/extra/binlog_tests/drop_temp_table.test	2010-06-29 10:54:58 +0000
@@ -69,4 +69,34 @@ let $VERSION=`SELECT VERSION()`;
 source include/show_binlog_events.inc;
 DROP DATABASE `drop-temp+table-test`;
 
+
+#
+# Bug #54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW
+#
+# Sanity test. Checking that implicit DROP event is logged.
+#
+# After BUG#52616, the switch to ROW mode becomes effective even
+# if there are open temporary tables. As such the implicit drop
+# for temporary tables on session closing must be logged.
+#
+
+RESET MASTER;
+
+CREATE TABLE t1 ( i text );
+
+--connect(con1,localhost,root,,)
+CREATE TEMPORARY TABLE ttmp1 ( i text );
+SET @@session.binlog_format=ROW;
+INSERT INTO t1 VALUES ('1');
+SELECT @@session.binlog_format;
+--disconnect con1
+
+-- connection default
+--let $wait_binlog_event= DROP
+--source include/wait_for_binlog_event.inc
+-- source include/show_binlog_events.inc
+RESET MASTER;
+
+DROP TABLE t1;
+
 # End of 4.1 tests

=== modified file 'mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test'
--- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test	2010-04-28 12:47:49 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test	2010-06-30 15:25:13 +0000
@@ -77,11 +77,11 @@ eval UPDATE t2, t1 SET t2.data = CONCAT(
 connection slave;
 --source include/wait_for_slave_sql_to_stop.inc
 
-if (`SELECT @@binlog_format = 'STATEMENT'`)
+if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
 {
   SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
 }
-if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
+if (`SELECT @@binlog_format = 'ROW'`)
 {
   SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2;
 }

=== added file 'mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc'
--- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc	2010-06-30 19:37:41 +0000
@@ -0,0 +1,967 @@
+--source include/have_innodb.inc
+--disable_abort_on_error
+
+if (`SELECT HEX(@commands) = HEX('configure')`)
+{
+  connection master;
+
+  #
+  # Creates a T-table that is never dropped.
+  #
+  --eval CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb
+
+  #
+  # Creates a N-table that is never dropped.
+  #
+  --eval CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam
+
+  #
+  # Creates a Temporary N-table that is never dropped.
+  #
+  --eval CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam
+
+  #
+  # Creates a Temporary N-table that is never dropped.
+  #
+  --eval CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb
+
+  #
+  # In what follows, we create a set of tables that are used
+  # throughout this test case. The number of tables to be
+  # created is give by the variable $tot_table.
+  #
+  #
+  # Creates Temporay N-tables that are automatically dropped and recreated
+  # when a command ends.
+  #
+  --let $n= $tot_table
+  while (`SELECT $n != 0`)
+  { 
+    --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
+    --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam
+    --disable_query_log
+    --eval SET @check_temp='$available_n_temp'
+    --enable_query_log
+    #
+    # Updates the $available_n_temp that keeps track of the created
+    # temporary N-tables.
+    # 
+    if (`SELECT HEX(@check_temp) != HEX('')`)
+    {
+      --let $available_n_temp= $available_n_temp,nt_tmp_$n
+    }
+    if (`SELECT HEX(@check_temp) = HEX('')`)
+    {
+      --let $available_n_temp= nt_tmp_$n
+    }
+    --dec $n
+  }
+
+  #
+  # Creates Temporay T-tables that are automatically dropped and recreated
+  # when a command ends.
+  #
+  --let $n= $tot_table
+  while (`SELECT $n != 0`)
+  { 
+    --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
+    --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb
+    --disable_query_log
+    --eval SET @check_temp='$available_t_temp'
+    --enable_query_log
+    #
+    # Updates the $available_t_temp that keeps track of the created
+    # temporary T-tables.
+    # 
+    if (`SELECT HEX(@check_temp) != HEX('')`)
+    {
+      --let $available_t_temp= $available_t_temp,tt_tmp_$n
+    }
+    if (`SELECT HEX(@check_temp) = HEX('')`)
+    {
+      --let $available_t_temp= tt_tmp_$n
+    }
+    --dec $n
+  }
+
+  #
+  # Creates N-tables that are automatically dropped and recreated
+  # when a command ends.
+  #
+  --let $n= $tot_table
+  while (`SELECT $n != 0`)
+  { 
+    --eval DROP TABLE IF EXISTS nt_$n
+    --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam
+    --disable_query_log
+    --eval SET @check_temp='$available_n'
+    --enable_query_log
+    #
+    # Updates the $available_n that keeps track of the created
+    # N-tables.
+    # 
+    if (`SELECT HEX(@check_temp) != HEX('')`)
+    {
+      --let $available_n= $available_n,nt_$n
+    }
+    if (`SELECT HEX(@check_temp) = HEX('')`)
+    {
+      --let $available_n= nt_$n
+    }
+    --dec $n
+  }
+
+  #
+  # Creates T-tables that are automatically dropped and recreated
+  # when a command ends.
+  #
+  --let $n= $tot_table
+  while (`SELECT $n != 0`)
+  { 
+    --eval DROP TABLE IF EXISTS tt_$n
+    --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb
+    --disable_query_log
+    --eval SET @check_temp='$available_t'
+    --enable_query_log
+    #
+    # Updates the $available_t that keeps track of the created
+    # T-tables.
+    # 
+    if (`SELECT HEX(@check_temp) != HEX('')`)
+    {
+      --let $available_t= $available_t,tt_$n
+    }
+    if (`SELECT HEX(@check_temp) = HEX('')`)
+    {
+      --let $available_t= tt_$n
+    }
+    --dec $n
+  }
+
+  --let $dropped_t_temp=
+  --let $dropped_n_temp=
+
+  --let $dropped_t=
+  --let $dropped_n=
+
+  let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
+
+  SET @commands= '';
+}
+
+#
+# Drops tables and synchronizes master and slave. Note that temporary
+# tables are not explitcily dropped as they will be dropped while
+# closing the connection.
+#
+if (`SELECT HEX(@commands) = HEX('clean')`)
+{
+  connection master;
+
+  DROP TABLE IF EXISTS tt_xx_1;
+
+  DROP TABLE IF EXISTS nt_xx_1;
+
+  --let $n= $tot_table
+  while (`SELECT $n != 0`)
+  { 
+    --eval DROP TABLE IF EXISTS nt_$n
+    --dec $n
+  }
+
+  --let $n= $tot_table
+  while (`SELECT $n != 0`)
+  { 
+    --eval DROP TABLE IF EXISTS tt_$n
+    --dec $n
+  }
+
+  sync_slave_with_master;
+
+  SET @commands= '';
+}
+
+#
+# This is the core of the test is responsible for processing
+# the following commands:
+#
+# B - Begin
+# C - Commit
+# R - Rollback
+#
+#
+# T - Inserts a row into a T-table
+# N-Temp - Inserts a row into a temporary N-table.
+#
+#
+# T-SELECT-N-Temp - Selects from a temporary N-table and inserts
+#                   into a T-table.
+# N-SELECT-N-Temp - Selects from a temporary N-table and inserts
+#                   into a N-table.
+# T-SELECT-T-Temp - Selects from a temporary T-table and inserts
+#                   into a T-table.
+# N-SELECT-T-Temp - Selects from a temporary T-table and inserts
+#                   into a N-table.
+#
+#
+# Create-N-Temp - Creates a temporary N-table if a temporary N-table
+#                 was dropped before
+# Create-T-Temp - Creates a temporary T-table if a temporary T-table
+#                 was dropped before
+#
+#
+# Drop-Temp-T-Temp - Drops a temporary T-table if there is any
+# Drop-Temp-N-Temp - Drops a temporary N-table if there is any
+# Drop-Temp-TN-Temp - Drops both a temporary T-table and N-table if there
+#                     is any
+# Drop-Temp-TT-Temp - Drops two temporary T-tables if there is any
+# Drop-Temp-NN-Temp - Drops two temporary N-tables if there is any
+# Drop-Temp-Xe-Temp - Tries to drop a temporary table that does not exist
+# Drop-Temp-NXe-Temp - Drops a temporary N-table if there is any and
+#                      a temporary table that does not exist
+# Drop-Temp-TXe-Temp - Drops a temporary T-table if there is any and
+#                      a temporary table that does not exist
+#
+#
+# Drop-Temp-If-Xe-Temp - Tries to drop a temporary table that does not exist
+# Drop-Temp-If-TXe-Temp - Drops a temporary T-table if there is any and
+#                         a temporary table that does not exist
+#
+#
+# Drop-T - Drops a T-table if there is any
+# Drop-N - Drops a  N-table if there is any
+# Drop-Xe - Tries to drop a table that does not exist
+# Drop-TXe - Drops a T-table if there is any and a table that does
+#            not exist
+# Drop-NXe - Drops a N-table if there is any and a table that does
+#            not exist
+# Drop-TN - Drops both a T-table and N-table if there is any
+# Drop-TT - Drops two T-tables if there is any
+# Drop-NN - Drops two N-tables if there is any
+# Drop-N-TN-Temp - Drops a N-table and both a temporary T-table and
+#                  N-table if there is any
+#
+#
+# Drop-If-Xe - Tries to drop a table that does not exist
+# Drop-If-TXe - Drops a T-table if there is any and a table that does
+#               not exist
+# Drop-If-NXe - Drops a N-table if there is any and a table that does
+#               not exist
+#
+while (`SELECT HEX(@commands) != HEX('')`)
+{
+  --disable_query_log
+  SET @command= SUBSTRING_INDEX(@commands, ' ', 1);
+  let $command= `SELECT @command`;
+  --eval SET @check_commands= '$commands'
+  if (`SELECT HEX(@check_commands) = HEX('''')`)
+  {
+    let $commands= `SELECT @commands`;
+  }
+
+  if (`SELECT HEX(@command) = HEX('B')`)
+  {
+    --enable_query_log
+    eval BEGIN;
+   --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('T')`)
+  {
+    --enable_query_log
+    eval INSERT INTO tt_xx_1() VALUES (1);
+   --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('N')`)
+  {
+    --enable_query_log
+    eval INSERT INTO nt_xx_1() VALUES (1);
+   --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('N-Temp')`)
+  {
+    --enable_query_log
+    eval INSERT INTO nt_tmp_xx_1() VALUES (1);
+   --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('N-SELECT-N-Temp')`)
+  {
+    --enable_query_log
+    eval INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+   --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('N-SELECT-T-Temp')`)
+  {
+    --enable_query_log
+    eval INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+   --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('T-SELECT-N-Temp')`)
+  {
+    --enable_query_log
+    eval INSERT INTO tt_xx_1 SELECT * FROM nt_tmp_xx_1;
+   --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('T-SELECT-T-Temp')`)
+  {
+    --enable_query_log
+    eval INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+   --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('Create-N-Temp') || HEX(@command) = HEX('Create-T-Temp')`)
+  {
+    if (`SELECT HEX(@command) = HEX('Create-N-Temp')`)
+    {
+      --let $dropped_temp=$dropped_n_temp
+      --let $available_temp=$available_n_temp
+    }
+    if (`SELECT HEX(@command) = HEX('Create-T-Temp')`)
+    {
+      --let $dropped_temp=$dropped_t_temp
+      --let $available_temp=$available_t_temp
+    }
+
+    --eval SET @check_temp='$dropped_temp'
+    if (`SELECT HEX(@check_temp) != HEX('')`)
+    {
+      SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1);
+      let $table=`SELECT @temp`;
+      --eval SET @check_temp='$available_temp'
+      if (`SELECT HEX(@check_temp) != HEX('')`)
+      {
+        --let $available_temp= $available_temp,$table
+      }
+      if (`SELECT HEX(@check_temp) = HEX('')`)
+      {
+        --let $available_temp= $table
+      }
+      --eval SET @check_temp='$dropped_temp'
+      --eval SET @table_temp='$table'
+      SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+      --let $dropped_temp= `SELECT @check_temp`
+
+      if (`SELECT HEX(@command) = HEX('Create-N-Temp')`)
+      {
+        --enable_query_log
+        --eval CREATE TEMPORARY TABLE $table ( id INT ) engine= MyIsam
+        --disable_query_log
+
+        --let $available_n_temp= $available_temp
+        --let $dropped_n_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Create-T-Temp')`)
+      {
+        --enable_query_log
+        --eval CREATE TEMPORARY TABLE $table ( id INT ) engine= Innodb
+        --disable_query_log
+
+        --let $available_t_temp= $available_temp
+        --let $dropped_t_temp= $dropped_temp
+      }
+    }
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp') || HEX(@command) = HEX('Drop-Temp-T-Temp') || HEX(@command) = HEX('Drop-T') || HEX(@command) = HEX('Drop-N')`)
+  {
+    if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp')`)
+    {
+      --let $dropped_temp=$dropped_n_temp
+      --let $available_temp=$available_n_temp
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-Temp-T-Temp')`)
+    {
+      --let $dropped_temp=$dropped_t_temp
+      --let $available_temp=$available_t_temp
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-N')`)
+    {
+      --let $dropped_temp=$dropped_n
+      --let $available_temp=$available_n
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-T')`)
+    {
+      --let $dropped_temp=$dropped_t
+      --let $available_temp=$available_t
+    }
+
+    --eval SET @check_temp='$available_temp'
+    if (`SELECT HEX(@check_temp) != HEX('')`)
+    {
+      SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1);
+      let $table=`SELECT @temp`;
+      --eval SET @check_temp='$dropped_temp'
+      if (`SELECT HEX(@check_temp) != HEX('')`)
+      {
+        --let $dropped_temp= $dropped_temp,$table
+      }
+      if (`SELECT HEX(@check_temp) = HEX('')`)
+      {
+        --let $dropped_temp= $table
+      }
+      --eval SET @check_temp='$available_temp'
+      --eval SET @table_temp='$table'
+      SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+      --let $available_temp= `SELECT @check_temp`
+
+      if (`SELECT HEX(@command) = HEX('Drop-Temp-N-Temp')`)
+      {
+        --enable_query_log
+        --eval DROP TEMPORARY TABLE $table
+        --disable_query_log
+
+        --let $available_n_temp= $available_temp
+        --let $dropped_n_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-Temp-T-Temp')`)
+      {
+        --enable_query_log
+        --eval DROP TEMPORARY TABLE $table
+        --disable_query_log
+
+        --let $available_t_temp= $available_temp
+        --let $dropped_t_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-N')`)
+      {
+        --enable_query_log
+        --eval DROP TABLE $table
+        --disable_query_log
+
+        --let $available_n= $available_temp
+        --let $dropped_n= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-T')`)
+      {
+        --enable_query_log
+        --eval DROP TABLE $table
+        --disable_query_log
+
+        --let $available_t= $available_temp
+        --let $dropped_t= $dropped_temp
+      }
+    }
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-Temp-Xe-Temp')`)
+  {
+    --enable_query_log
+    --eval DROP TEMPORARY TABLE tt_xx_1
+    --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-Temp-If-Xe-Temp')`)
+  {
+    --enable_query_log
+    --eval DROP TEMPORARY TABLE IF EXISTS tt_xx_1
+    --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-Xe')`)
+  {
+    --enable_query_log
+    --eval DROP TABLE xx_1
+    --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-If-Xe')`)
+  {
+    --enable_query_log
+    --eval DROP TABLE IF EXISTS xx_1
+    --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-TXe-Temp') || HEX(@command) = HEX('Drop-NXe') || HEX(@command) = HEX('Drop-TXe') || HEX(@command) = HEX('Drop-Temp-If-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-TXe-Temp') || HEX(@command) = HEX('Drop-If-NXe') || HEX(@command) = HEX('Drop-If-TXe')`)
+  {
+    if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-NXe-Temp')`)
+    {
+      --let $dropped_temp=$dropped_n_temp
+      --let $available_temp=$available_n_temp
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-Temp-TXe-Temp') || HEX(@command) = HEX('Drop-Temp-If-TXe-Temp')`)
+    {
+      --let $dropped_temp=$dropped_t_temp
+      --let $available_temp=$available_t_temp
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-NXe') || HEX(@command) = HEX('Drop-If-NXe')`)
+    {
+      --let $dropped_temp=$dropped_n
+      --let $available_temp=$available_n
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-TXe') || HEX(@command) = HEX('Drop-If-TXe')`)
+    {
+      --let $dropped_temp=$dropped_t
+      --let $available_temp=$available_t
+    }
+
+    --eval SET @check_temp='$available_temp'
+    if (`SELECT HEX(@check_temp) != HEX('')`)
+    {
+      SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1);
+      let $table=`SELECT @temp`;
+      --eval SET @check_temp='$dropped_temp'
+      if (`SELECT HEX(@check_temp) != HEX('')`)
+      {
+        --let $dropped_temp= $dropped_temp,$table
+      }
+      if (`SELECT HEX(@check_temp) = HEX('')`)
+      {
+        --let $dropped_n_temp= $table
+      }
+      --eval SET @check_temp='$available_temp'
+      --eval SET @table_temp='$table'
+      SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+      --let $available_temp= `SELECT @check_temp`
+
+      if (`SELECT HEX(@command) = HEX('Drop-Temp-NXe-Temp')`)
+      {
+        --enable_query_log
+        --eval DROP TEMPORARY TABLE $table, tt_1
+        --disable_query_log
+
+        --let $available_n_temp= $available_temp
+        --let $dropped_n_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-Temp-If-NXe-Temp')`)
+      {
+        --enable_query_log
+        --eval DROP TEMPORARY TABLE IF EXISTS $table, tt_1
+        --disable_query_log
+
+        --let $available_n_temp= $available_temp
+        --let $dropped_n_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-Temp-TXe-Temp')`)
+      {
+        --enable_query_log
+        --eval DROP TEMPORARY TABLE $table, tt_1
+        --disable_query_log
+
+        --let $available_t_temp= $available_temp
+        --let $dropped_t_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-Temp-If-TXe-Temp')`)
+      {
+        --enable_query_log
+        --eval DROP TEMPORARY TABLE IF EXISTS $table, tt_1
+        --disable_query_log
+
+        --let $available_t_temp= $available_temp
+        --let $dropped_t_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-NXe')`)
+      {
+        --enable_query_log
+        --eval DROP TABLE $table, xx_1
+        --disable_query_log
+
+        --let $available_n= $available_temp
+        --let $dropped_n= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-If-NXe')`)
+      {
+        --enable_query_log
+        --eval DROP TABLE IF EXISTS $table, xx_1
+        --disable_query_log
+
+        --let $available_n= $available_temp
+        --let $dropped_n= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-TXe')`)
+      {
+        --enable_query_log
+        --eval DROP TABLE $table, xx_1
+        --disable_query_log
+
+        --let $available_t= $available_temp
+        --let $dropped_t= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-If-TXe')`)
+      {
+        --enable_query_log
+        --eval DROP TABLE IF EXISTS $table, xx_1
+        --disable_query_log
+
+        --let $available_t= $available_temp
+        --let $dropped_t= $dropped_temp
+      }
+    }
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp') || HEX(@command) = HEX('Drop-Temp-TT-Temp') || HEX(@command) = HEX('Drop-NN') || HEX(@command) = HEX('Drop-TT')`)
+  {
+    if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp')`)
+    {
+      --let $dropped_temp=$dropped_n_temp
+      --let $available_temp=$available_n_temp
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-Temp-TT-Temp')`)
+    {
+      --let $dropped_temp=$dropped_t_temp
+      --let $available_temp=$available_t_temp
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-NN')`)
+    {
+      --let $dropped_temp=$dropped_n
+      --let $available_temp=$available_n
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-TT')`)
+    {
+      --let $dropped_temp=$dropped_t
+      --let $available_temp=$available_t
+    }
+
+    --eval SET @check_temp='$available_temp'
+    if (`SELECT HEX(@check_temp) != HEX('')`)
+    {
+      --let $n= 2
+      while (`SELECT HEX(@check_temp) != HEX('') && $n != 0`)
+      {
+        SET @temp= SUBSTRING_INDEX(@check_temp, ',', 1);
+        let $table=`SELECT @temp`;
+        --eval SET @check_temp='$dropped_temp'
+        if (`SELECT HEX(@check_temp) != HEX('')`)
+        {
+          --let $dropped_temp= $dropped_temp,$table
+        }
+        if (`SELECT HEX(@check_temp) = HEX('')`)
+        {
+          --let $dropped_temp= $table
+        }
+        if (`SELECT $n = 1`)
+        {
+          --let $table_1= $table
+        }
+        if (`SELECT $n = 2`)
+        {
+          --let $table_2= $table
+        }
+
+        --dec $n
+        --eval SET @check_temp='$available_temp'
+        --eval SET @table_temp='$table'
+        SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+        --let $available_temp= `SELECT @check_temp`
+      }
+
+      if (`SELECT HEX(@command) = HEX('Drop-Temp-NN-Temp') && $n = 0`)
+      {
+        --enable_query_log
+        --eval DROP TEMPORARY TABLE $table_1, $table_2
+        --disable_query_log
+
+        --let $available_n_temp= $available_temp
+        --let $dropped_n_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-Temp-TT-Temp') && $n= 0`)
+      {
+        --enable_query_log
+        --eval DROP TEMPORARY TABLE $table_1, $table_2
+        --disable_query_log
+
+        --let $available_t_temp= $available_temp
+        --let $dropped_t_temp= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-NN') && $n = 0`)
+      {
+        --enable_query_log
+        --eval DROP TABLE $table_1, $table_2
+        --disable_query_log
+
+        --let $available_n= $available_temp
+        --let $dropped_n= $dropped_temp
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-TT') && $n= 0`)
+      {
+        --enable_query_log
+        --eval DROP TABLE $table_1, $table_2
+        --disable_query_log
+
+        --let $available_t= $available_temp
+        --let $dropped_t= $dropped_temp
+      }
+    }
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-Temp-TN-Temp')`)
+  {
+    --eval SET @check_temp_t='$available_t_temp'
+    --eval SET @check_temp_n='$available_n_temp'
+    if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('')`)
+    {
+      SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1);
+      let $table_t=`SELECT @temp_t`;
+      --eval SET @check_temp_t='$dropped_t_temp'
+      if (`SELECT HEX(@check_temp_t) != HEX('')`)
+      {
+        --let $dropped_t_temp= $dropped_t_temp,$table_t
+      }
+      if (`SELECT HEX(@check_temp_t) = HEX('')`)
+      {
+        --let $dropped_t_temp= $table_t
+      }
+      --eval SET @check_temp='$available_t_temp'
+      --eval SET @table_temp='$table_t'
+      SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+      --let $available_t_temp= `SELECT @check_temp`
+
+      SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1);
+      let $table_n=`SELECT @temp_n`;
+      --eval SET @check_temp_n='$dropped_n_temp'
+      if (`SELECT HEX(@check_temp_n) != HEX('')`)
+      {
+        --let $dropped_n_temp= $dropped_n_temp,$table_n
+      }
+      if (`SELECT HEX(@check_temp_n) = HEX('')`)
+      {
+        --let $dropped_n_temp= $table_n
+      }
+      --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`
+
+      --enable_query_log
+      --eval DROP TEMPORARY TABLE $table_t, $table_n
+      --disable_query_log
+    }
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-TN')`)
+  {
+    --eval SET @check_temp_t='$available_t'
+    --eval SET @check_temp_n='$available_n'
+    if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('')`)
+    {
+      SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1);
+      let $table_t=`SELECT @temp_t`;
+      --eval SET @check_temp_t='$dropped_t'
+      if (`SELECT HEX(@check_temp_t) != HEX('')`)
+      {
+        --let $dropped_t= $dropped_t,$table_t
+      }
+      if (`SELECT HEX(@check_temp_t) = HEX('')`)
+      {
+        --let $dropped_t= $table_t
+      }
+      --eval SET @check_temp='$available_t'
+      --eval SET @table_temp='$table_t'
+      SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+      --let $available_t= `SELECT @check_temp`
+
+      SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1);
+      let $table_n=`SELECT @temp_n`;
+      --eval SET @check_temp_n='$dropped_n'
+      if (`SELECT HEX(@check_temp_n) != HEX('')`)
+      {
+        --let $dropped_n= $dropped_n,$table_n
+      }
+      if (`SELECT HEX(@check_temp_n) = HEX('')`)
+      {
+        --let $dropped_n= $table_n
+      }
+      --eval SET @check_temp='$available_n'
+      --eval SET @table_temp='$table_n'
+      SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+      --let $available_t= `SELECT @check_temp`
+
+      --enable_query_log
+      --eval DROP TABLE $table_t, $table_n
+      --disable_query_log
+    }
+  }
+
+  if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp') || HEX(@command) = HEX('Drop-TN-Temp')`)
+  {
+    --eval SET @check_temp_t='$available_t_temp'
+    --eval SET @check_temp_n='$available_n_temp'
+    if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp')`)
+    {
+      --eval SET @check_n='$available_n'
+    }
+    if (`SELECT HEX(@command) = HEX('Drop-TN-Temp')`)
+    {
+      #
+      # Just to be possible to go through the next if...
+      #
+      --eval SET @check_n='...'
+    }
+    if (`SELECT HEX(@check_temp_t) != HEX('') && HEX(@check_temp_n) != HEX('') && HEX(@check_n) != HEX('')`)
+    {
+      SET @temp_t= SUBSTRING_INDEX(@check_temp_t, ',', 1);
+      let $table_temp_t=`SELECT @temp_t`;
+      --eval SET @check_temp_t='$dropped_t_temp'
+      if (`SELECT HEX(@check_temp_t) != HEX('')`)
+      {
+        --let $dropped_t_temp= $dropped_t_temp,$table_temp_t
+      }
+      if (`SELECT HEX(@check_temp_t) = HEX('')`)
+      {
+        --let $dropped_t_temp= $table_temp_t
+      }
+      --eval SET @check_temp='$available_t_temp'
+      --eval SET @table_temp='$table_temp_t'
+      SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+      --let $available_t_temp= `SELECT @check_temp`
+
+      SET @temp_n= SUBSTRING_INDEX(@check_temp_n, ',', 1);
+      let $table_temp_n=`SELECT @temp_n`;
+      --eval SET @check_temp_n='$dropped_n_temp'
+      if (`SELECT HEX(@check_temp_n) != HEX('')`)
+      {
+        --let $dropped_n_temp= $dropped_n_temp,$table_temp_n
+      }
+      if (`SELECT HEX(@check_temp_n) = HEX('')`)
+      {
+        --let $dropped_n_temp= $table_temp_n
+      }
+      --eval SET @check_temp='$available_n_temp'
+      --eval SET @table_temp='$table_temp_n'
+      SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+      --let $available_n_temp= `SELECT @check_temp`
+
+      if (`SELECT HEX(@command) = HEX('Drop-N-TN-Temp')`)
+      {
+        SET @temp_n= SUBSTRING_INDEX(@check_n, ',', 1);
+        let $table_n=`SELECT @temp_n`;
+        --eval SET @check_n='$dropped_n'
+        if (`SELECT HEX(@check_n) != HEX('')`)
+        {
+          --let $dropped_n= $dropped_n,$table_n
+        }
+        if (`SELECT HEX(@check_n) = HEX('')`)
+        {
+          --let $dropped_n= $table_n
+        }
+        --eval SET @check_temp='$available_n'
+        --eval SET @table_temp='$table_n'
+        SET @check_temp= LTRIM(SUBSTRING(@check_temp, LENGTH(@table_temp) + 2));
+        --let $available_n= `SELECT @check_temp`
+
+        --enable_query_log
+        --eval DROP TABLE $table_temp_t, $table_temp_n, $table_n
+        --disable_query_log
+      }
+      if (`SELECT HEX(@command) = HEX('Drop-TN-Temp')`)
+      {
+        --enable_query_log
+        --eval DROP TABLE $table_temp_t, $table_temp_n
+        --disable_query_log
+      }
+    }
+  }
+
+  if (`SELECT HEX(@command) = HEX('C')`)
+  {
+    --enable_query_log
+    --error 0, ER_GET_ERRMSG
+    eval COMMIT;
+    --disable_query_log
+  }
+
+  if (`SELECT HEX(@command) = HEX('R')`)
+  {
+    --enable_query_log
+    --error 0, ER_GET_ERRMSG
+    eval ROLLBACK;
+    --disable_query_log
+  }
+
+  SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));
+  if (`SELECT HEX(@commands) = HEX('')`)
+  {
+    let $binlog_start= $pos_trans_command;
+    --echo -b-b-b-b-b-b-b-b-b-b-b- >> $commands << -b-b-b-b-b-b-b-b-b-b-b-
+    --source include/show_binlog_events.inc
+    --echo -e-e-e-e-e-e-e-e-e-e-e- >> $commands << -e-e-e-e-e-e-e-e-e-e-e-
+    --echo
+ 
+    --disable_warnings 
+    --let $available_n_temp=
+    --let $dropped_n_temp=
+    --let $n= $tot_table
+    while (`SELECT $n != 0`)
+    { 
+      --eval DROP TEMPORARY TABLE IF EXISTS nt_tmp_$n
+      --eval CREATE TEMPORARY TABLE nt_tmp_$n ( id INT ) ENGINE = MyIsam
+      --eval SET @check_temp='$available_n_temp'
+      if (`SELECT HEX(@check_temp) != HEX('')`)
+      {
+        --let $available_n_temp= $available_n_temp,nt_tmp_$n
+      }
+      if (`SELECT HEX(@check_temp) = HEX('')`)
+      {
+        --let $available_n_temp= nt_tmp_$n
+      }
+      --dec $n
+    }
+
+    --let $available_t_temp=
+    --let $dropped_t_temp=
+    --let $n= $tot_table
+    while (`SELECT $n != 0`)
+    { 
+      --eval DROP TEMPORARY TABLE IF EXISTS tt_tmp_$n
+      --eval CREATE TEMPORARY TABLE tt_tmp_$n ( id INT ) ENGINE = Innodb
+      --eval SET @check_temp='$available_t_temp'
+      if (`SELECT HEX(@check_temp) != HEX('')`)
+      {
+        --let $available_t_temp= $available_t_temp,tt_tmp_$n
+      }
+      if (`SELECT HEX(@check_temp) = HEX('')`)
+      {
+        --let $available_t_temp= tt_tmp_$n
+      }
+      --dec $n
+    }
+
+    --let $available_t=
+    --let $dropped_t=
+    --let $n= $tot_table
+    while (`SELECT $n != 0`)
+    { 
+      --eval DROP TABLE IF EXISTS tt_$n
+      --eval CREATE TABLE tt_$n ( id INT ) ENGINE = Innodb
+      --eval SET @check_temp='$available_t'
+      if (`SELECT HEX(@check_temp) != HEX('')`)
+      {
+        --let $available_t= $available_t,tt_$n
+      }
+      if (`SELECT HEX(@check_temp) = HEX('')`)
+      {
+        --let $available_t= tt_$n
+      }
+      --dec $n
+    }
+
+    --let $available_n=
+    --let $dropped_n=
+    --let $n= $tot_table
+    while (`SELECT $n != 0`)
+    { 
+      --eval DROP TABLE IF EXISTS nt_$n
+      --eval CREATE TABLE nt_$n ( id INT ) ENGINE = MyIsam
+      --eval SET @check_temp='$available_n'
+      if (`SELECT HEX(@check_temp) != HEX('')`)
+      {
+        --let $available_n= $available_n,nt_$n
+      }
+      if (`SELECT HEX(@check_temp) = HEX('')`)
+      {
+        --let $available_n= nt_$n
+      }
+      --dec $n
+    }
+    --enable_warnings 
+
+    let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
+    let $commands= '';
+  }
+  --enable_query_log
+}

=== added file 'mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test'
--- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test	2010-06-30 19:37:41 +0000
@@ -0,0 +1,389 @@
+###############################################################################
+#  In this test case, we check how changes to temporary tables are written
+#  to the binary log.
+#
+#  (TODO --- GET INFO AS SOON AS THE SITE IS AVAILABLE)
+#
+# This test uses the commands available at:
+#   extra/rpl_tests/rpl_drop_create_temp_table.inc
+#
+###############################################################################
+
+
+--echo #########################################################################
+--echo #                            CONFIGURATION
+--echo #########################################################################
+
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+
+--let $tot_table= 2
+SET @commands= 'configure';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo #########################################################################
+--echo #           1 - Tables dropped by "DROP TEMPORARY TABLE"
+--echo #########################################################################
+connection master;
+
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo #
+SET @commands= 'Drop-Temp-T-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-N-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-Xe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-If-Xe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-TXe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-If-TXe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-NXe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-If-NXe-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-TT-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-NN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+
+--echo
+--echo #
+--echo #2) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-Temp-T-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-Xe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TN-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TT-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NN-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+
+--echo
+--echo #
+--echo #3) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-Temp-T-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-Xe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TN-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TT-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NN-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+
+--echo #########################################################################
+--echo #                   2 - Tables dropped by "DROP TABLE"
+--echo #########################################################################
+connection master;
+
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo #
+SET @commands= 'Drop-T';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-N';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Xe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-If-Xe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-TXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-If-TXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-NXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-If-NXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-TN';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-TT';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-NN';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-N-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo
+--echo #
+--echo #2) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-T';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-N';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-Xe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-If-Xe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-TXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-If-TXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-NXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-If-NXe';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-TN';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-TT';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-NN';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-N-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B T Drop-TN-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo #########################################################################
+--echo #                      3 - CREATE TEMPORARY TABLE
+--echo #########################################################################
+connection master;
+
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo #
+SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo
+--echo #
+--echo #2) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo
+--echo #
+--echo #3) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+
+--echo #########################################################################
+--echo #                     4 -  CHANGING TEMPORARY TABLES
+--echo #########################################################################
+connection master;
+
+--echo
+--echo #
+--echo #1) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo
+--echo
+--echo #
+--echo #2) Generates in the binlog what follows:
+--echo #
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc
+
+--echo ###################################################################################
+--echo #                               CHECK CONSISTENCY
+--echo ###################################################################################
+connection master;
+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
+
+--echo #########################################################################
+--echo #                           CLEAN
+--echo #########################################################################
+SET @commands= 'clean';
+--source extra/rpl_tests/rpl_drop_create_temp_table.inc

=== modified file 'mysql-test/include/ctype_numconv.inc'
--- a/mysql-test/include/ctype_numconv.inc	2010-05-14 05:28:51 +0000
+++ b/mysql-test/include/ctype_numconv.inc	2010-07-09 05:39:41 +0000
@@ -1606,3 +1606,41 @@ drop function f1;
 --echo # End of WL#2649 Number-to-string conversions
 --echo #
 
+--echo #
+--echo # Bug#54668 User variable assignments get wrong type
+--echo #
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+
+
+--echo #
+--echo # Bug#52159 returning time type from function and empty left join causes debug assertion
+--echo #
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+DROP FUNCTION f1;
+DROP TABLE t1;
+
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+--disable_warnings
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+--enable_warnings
+DROP TABLE t1;
+SET sql_mode=default;

=== modified file 'mysql-test/include/mysqld--help.inc'
--- a/mysql-test/include/mysqld--help.inc	2010-05-17 15:28:50 +0000
+++ b/mysql-test/include/mysqld--help.inc	2010-07-08 21:20:08 +0000
@@ -13,7 +13,7 @@ perl;
   @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir
                log-slow-queries pid-file slow-query-log-file
 			   datadir slave-load-tmpdir tmpdir/;
-  @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster safemalloc debug temp-pool ssl des-key-file
+  @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file
               thread-concurrency super-large-pages mutex-deadlock-detector null-audit/;
   @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR /;
   $re1=join('|', @skipvars, @plugins);

=== modified file 'mysql-test/lib/v1/mtr_report.pl'
--- a/mysql-test/lib/v1/mtr_report.pl	2009-12-09 15:13:00 +0000
+++ b/mysql-test/lib/v1/mtr_report.pl	2010-07-08 21:20:08 +0000
@@ -253,19 +253,8 @@ sub mtr_report_stats ($) {
             mtr_warning("can't read $errlog");
             next;
           }
-          my $leak_reports_expected= undef;
           while ( <ERR> )
           {
-            # There is a test case that purposely provokes a
-            # SAFEMALLOC leak report, even though there is no actual
-            # leak. We need to detect this, and ignore the warning in
-            # that case.
-            if (/Begin safemalloc memory dump:/) {
-              $leak_reports_expected= 1;
-            } elsif (/End safemalloc memory dump./) {
-              $leak_reports_expected= undef;
-            }
-
             # Skip some non fatal warnings from the log files
             if (
 		/\"SELECT UNIX_TIMESTAMP\(\)\" failed on master/ or
@@ -426,9 +415,6 @@ sub mtr_report_stats ($) {
 	    }
             if ( /$pattern/ )
             {
-              if ($leak_reports_expected) {
-                next;
-              }
               $found_problems= 1;
               print WARN basename($errlog) . ": $testname: $_";
             }

=== modified file 'mysql-test/lib/v1/mysql-test-run.pl'
--- a/mysql-test/lib/v1/mysql-test-run.pl	2010-06-30 11:37:03 +0000
+++ b/mysql-test/lib/v1/mysql-test-run.pl	2010-07-13 08:39:24 +0000
@@ -3881,8 +3881,6 @@ sub mysqld_arguments ($$$$) {
 
   if ( $opt_valgrind_mysqld )
   {
-    mtr_add_arg($args, "%s--loose-skip-safemalloc", $prefix);
-
     if ( $mysql_version_id < 50100 )
     {
       mtr_add_arg($args, "%s--skip-bdb", $prefix);
@@ -4721,7 +4719,6 @@ sub run_check_testcase ($$) {
 
   mtr_add_arg($args, "--no-defaults");
   mtr_add_arg($args, "--silent");
-  mtr_add_arg($args, "--skip-safemalloc");
   mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
   mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
 
@@ -4804,7 +4801,6 @@ sub run_mysqltest ($) {
 
   mtr_add_arg($args, "--no-defaults");
   mtr_add_arg($args, "--silent");
-  mtr_add_arg($args, "--skip-safemalloc");
   mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
   mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
   mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);

=== modified file 'mysql-test/mysql-stress-test.pl'
--- a/mysql-test/mysql-stress-test.pl	2010-03-18 06:42:07 +0000
+++ b/mysql-test/mysql-stress-test.pl	2010-07-08 21:20:08 +0000
@@ -123,7 +123,7 @@ $pid_file="mysql_stress_test.pid";
 $opt_mysqltest= ($^O =~ /mswin32/i) ? "mysqltest.exe" : "mysqltest";
 $opt_check_tests_file="";
 # OBM adding a setting for 'max-connect-retries=20' the default of 500 is to high  
-@mysqltest_args=("--silent", "-v", "--skip-safemalloc", "--max-connect-retries=20");
+@mysqltest_args=("--silent", "-v", "--max-connect-retries=20");
 
 # Client ip address
 $client_ip=inet_ntoa((gethostbyname(hostname()))[4]);

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2010-06-23 10:17:59 +0000
+++ b/mysql-test/mysql-test-run.pl	2010-07-08 21:20:08 +0000
@@ -3180,7 +3180,6 @@ sub start_run_one ($$) {
   mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
 
   mtr_add_arg($args, "--silent");
-  mtr_add_arg($args, "--skip-safemalloc");
   mtr_add_arg($args, "--test-file=%s", "include/$run.test");
 
   my $errfile= "$opt_vardir/tmp/$name.err";
@@ -3759,25 +3758,6 @@ sub extract_server_log ($$) {
   }
   $Ferr = undef; # Close error log file
 
-  # mysql_client_test.test sends a COM_DEBUG packet to the server
-  # to provoke a SAFEMALLOC leak report, ignore any warnings
-  # between "Begin/end safemalloc memory dump"
-  if ( grep(/Begin safemalloc memory dump:/, @lines) > 0)
-  {
-    my $discard_lines= 1;
-    foreach my $line ( @lines )
-    {
-      if ($line =~ /Begin safemalloc memory dump:/){
-	$discard_lines = 1;
-      } elsif ($line =~ /End safemalloc memory dump./){
-	$discard_lines = 0;
-      }
-
-      if ($discard_lines){
-	$line = "ignored";
-      }
-    }
-  }
   return @lines;
 }
 
@@ -3873,8 +3853,6 @@ sub start_check_warnings ($$) {
 
   mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
   mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
-
-  mtr_add_arg($args, "--loose-skip-safemalloc");
   mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test");
 
   if ( $opt_embedded_server )
@@ -4305,8 +4283,6 @@ sub mysqld_arguments ($$$) {
 
   if ( $opt_valgrind_mysqld )
   {
-    mtr_add_arg($args, "--loose-skip-safemalloc");
-
     if ( $mysql_version_id < 50100 )
     {
       mtr_add_arg($args, "--skip-bdb");
@@ -4899,9 +4875,6 @@ sub start_check_testcase ($$$) {
 
   mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
   mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
-
-  mtr_add_arg($args, "--skip-safemalloc");
-
   mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result");
   mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test");
   mtr_add_arg($args, "--verbose");
@@ -4942,7 +4915,6 @@ sub start_mysqltest ($) {
 
   mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
   mtr_add_arg($args, "--silent");
-  mtr_add_arg($args, "--skip-safemalloc");
   mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
   mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
   mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);

=== modified file 'mysql-test/r/ctype_binary.result'
--- a/mysql-test/r/ctype_binary.result	2010-05-14 05:28:51 +0000
+++ b/mysql-test/r/ctype_binary.result	2010-07-09 05:39:41 +0000
@@ -2567,5 +2567,56 @@ drop function f1;
 # End of WL#2649 Number-to-string conversions
 #
 #
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+binary	binary
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+binary	binary
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+binary	binary
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+binary	binary
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+binary	binary
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+binary	binary
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+binary	binary
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
+#
 # End of 5.5 tests
 #

=== modified file 'mysql-test/r/ctype_cp1251.result'
--- a/mysql-test/r/ctype_cp1251.result	2010-05-14 05:28:51 +0000
+++ b/mysql-test/r/ctype_cp1251.result	2010-07-09 05:39:41 +0000
@@ -2649,5 +2649,56 @@ drop function f1;
 # End of WL#2649 Number-to-string conversions
 #
 #
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+cp1251	cp1251_general_ci
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+cp1251	cp1251_general_ci
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+cp1251	cp1251_general_ci
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+cp1251	cp1251_general_ci
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+cp1251	cp1251_general_ci
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+cp1251	cp1251_general_ci
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+cp1251	cp1251_general_ci
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
+#
 # End of 5.5 tests
 #

=== modified file 'mysql-test/r/ctype_latin1.result'
--- a/mysql-test/r/ctype_latin1.result	2010-05-14 05:28:51 +0000
+++ b/mysql-test/r/ctype_latin1.result	2010-07-09 05:39:41 +0000
@@ -2977,5 +2977,56 @@ drop function f1;
 # End of WL#2649 Number-to-string conversions
 #
 #
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+latin1	latin1_swedish_ci
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+latin1	latin1_swedish_ci
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+latin1	latin1_swedish_ci
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+latin1	latin1_swedish_ci
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+latin1	latin1_swedish_ci
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+latin1	latin1_swedish_ci
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+latin1	latin1_swedish_ci
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
+#
 # End of 5.5 tests
 #

=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result	2010-05-20 12:35:28 +0000
+++ b/mysql-test/r/ctype_ucs.result	2010-07-09 05:39:41 +0000
@@ -3808,6 +3808,57 @@ drop function f1;
 #
 # End of WL#2649 Number-to-string conversions
 #
+#
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+ucs2	ucs2_general_ci
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+ucs2	ucs2_general_ci
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+ucs2	ucs2_general_ci
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+ucs2	ucs2_general_ci
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+ucs2	ucs2_general_ci
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+ucs2	ucs2_general_ci
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x)	collation(@x)
+ucs2	ucs2_general_ci
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
 SET NAMES latin1;
 #
 # End of 5.5 tests

=== renamed file 'mysql-test/r/analyse.result' => 'mysql-test/r/func_analyse.result'
=== modified file 'mysql-test/r/func_digest.result'
--- a/mysql-test/r/func_digest.result	2010-04-13 15:04:45 +0000
+++ b/mysql-test/r/func_digest.result	2010-07-07 06:38:11 +0000
@@ -1405,3 +1405,24 @@ LENGTH(SHA2( 'size', 384 )) / 2 * 8     
 SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8   = 512;
 LENGTH(SHA2( 'computed', 512 )) / 2 * 8   = 512
 1
+#
+# Bug#54661 sha2() returns BINARY result
+#
+SET NAMES binary;
+SELECT sha2('1',224);
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					sha2('1',224)	253	56	56	Y	128	31	63
+sha2('1',224)
+e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
+SET NAMES utf8;
+SELECT sha2('1',224);
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					sha2('1',224)	253	168	56	Y	0	31	33
+sha2('1',224)
+e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178
+SET NAMES latin1;
+SELECT sha2('1',224);
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					sha2('1',224)	253	56	56	Y	0	31	8
+sha2('1',224)
+e25388fde8290dc286a6164fa2d97e551b53498dcbf7bc378eb1f178

=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2010-02-20 10:07:32 +0000
+++ b/mysql-test/r/information_schema.result	2010-07-05 07:34:29 +0000
@@ -1427,7 +1427,7 @@ USE test;
 End of 5.0 tests.
 select * from information_schema.engines WHERE ENGINE="MyISAM";
 ENGINE	SUPPORT	COMMENT	TRANSACTIONS	XA	SAVEPOINTS
-MyISAM	DEFAULT	Default engine as of MySQL 3.23 with great performance	NO	NO	NO
+MyISAM	DEFAULT	MyISAM storage engine	NO	NO	NO
 grant select on *.* to user3148@localhost;
 select user,db from information_schema.processlist;
 user	db

=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result	2010-06-17 20:51:35 +0000
+++ b/mysql-test/r/partition_innodb.result	2010-07-06 17:38:03 +0000
@@ -373,3 +373,21 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB
 PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
 CREATE INDEX i1 ON t1 (a);
 DROP TABLE t1;
+#
+# Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00')
+ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1;
+SET @old_mode = @@sql_mode;
+SET SESSION sql_mode = 'NO_ZERO_DATE';
+OPTIMIZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
+test.t1	optimize	error	Invalid default value for 'b'
+test.t1	optimize	status	Operation failed
+Warnings:
+Warning	1265	Data truncated for column 'b' at row 1
+Error	1067	Invalid default value for 'b'
+SET SESSION sql_mode = @old_mode;
+DROP TABLE t1;

=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result	2010-04-29 20:33:06 +0000
+++ b/mysql-test/r/select.result	2010-07-08 13:19:05 +0000
@@ -4857,3 +4857,22 @@ SELECT * FROM t1 WHERE 102 < c;
 a	b	c
 DROP TABLE t1;
 End of 5.1 tests
+#
+# Bug#54515: Crash in opt_range.cc::get_best_group_min_max on 
+#            SELECT from VIEW with GROUP BY
+#
+CREATE TABLE t1 (
+col_int_key int DEFAULT NULL,
+KEY int_key (col_int_key)
+) ;
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW view_t1 AS 
+SELECT t1.col_int_key AS col_int_key
+FROM t1;
+SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
+col_int_key
+1
+2
+DROP VIEW view_t1;
+DROP TABLE t1;
+# End of test BUG#54515

=== modified file 'mysql-test/r/sp_trans_log.result'
--- a/mysql-test/r/sp_trans_log.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/r/sp_trans_log.result	2010-07-04 19:35:05 +0000
@@ -14,7 +14,7 @@ end|
 reset master|
 insert into t2 values (bug23333(),1)|
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-show binlog events from <binlog_start>|
+show binlog events from <binlog_start> limit 0, 4|
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)

=== modified file 'mysql-test/suite/binlog/r/binlog_multi_engine.result'
--- a/mysql-test/suite/binlog/r/binlog_multi_engine.result	2010-06-01 23:25:08 +0000
+++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result	2010-06-30 15:25:13 +0000
@@ -7,8 +7,6 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
 INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
 INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
-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.
 The last event before the COMMIT is use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
 *** Please look in binlog_multi_engine.test if you have a diff here ****
 START TRANSACTION;
@@ -73,6 +71,9 @@ mysqld-bin.000001	#	Table_map	#	#	table_
 mysqld-bin.000001	#	Write_rows	#	#	table_id: #
 mysqld-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 mysqld-bin.000001	#	Query	#	#	COMMIT
+mysqld-bin.000001	#	Query	#	#	BEGIN
+mysqld-bin.000001	#	Query	#	#	use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
+mysqld-bin.000001	#	Query	#	#	COMMIT
 mysqld-bin.000001	#	Query	#	#	use `test`; TRUNCATE t1m
 mysqld-bin.000001	#	Query	#	#	use `test`; TRUNCATE t1b
 mysqld-bin.000001	#	Query	#	#	use `test`; TRUNCATE t1n

=== 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-04-20 09:10:43 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result	2010-06-29 10:54:58 +0000
@@ -33,4 +33,23 @@ master-bin.000001	#	Query	#	#	use `drop-
 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 /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
 DROP DATABASE `drop-temp+table-test`;
+RESET MASTER;
+CREATE TABLE t1 ( i text );
+CREATE TEMPORARY TABLE ttmp1 ( i text );
+SET @@session.binlog_format=ROW;
+INSERT INTO t1 VALUES ('1');
+SELECT @@session.binlog_format;
+@@session.binlog_format
+ROW
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 ( i text )
+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 /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`
+RESET MASTER;
+DROP TABLE t1;

=== 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-06-01 19:34:40 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result	2010-06-29 10:54:58 +0000
@@ -297,6 +297,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; create table t2 (n int) engine=innodb
+master-bin.000001	#	Query	#	#	use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti`
 do release_lock("lock1");
 drop table t0,t2;
 set autocommit=0;

=== modified file 'mysql-test/suite/binlog/r/binlog_stm_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result	2010-06-30 15:25:13 +0000
@@ -635,7 +635,9 @@ COERCIBILITY(NAME_CONST('s1', _utf8'test
 COERCIBILITY(s1) d3;
 DROP TEMPORARY TABLE tmp1;
 END
-master-bin.000001	#	Query	#	#	use `bug39182`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
+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
 DROP PROCEDURE p1;
 DROP TABLE t1;
 DROP DATABASE bug39182;

=== 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-02-26 13:16:46 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result	2010-06-29 10:54:58 +0000
@@ -42,3 +42,22 @@ master-bin.000001	#	Query	#	#	use `drop-
 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 /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
 DROP DATABASE `drop-temp+table-test`;
+RESET MASTER;
+CREATE TABLE t1 ( i text );
+CREATE TEMPORARY TABLE ttmp1 ( i text );
+SET @@session.binlog_format=ROW;
+INSERT INTO t1 VALUES ('1');
+SELECT @@session.binlog_format;
+@@session.binlog_format
+ROW
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 ( i text )
+master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE ttmp1 ( i text )
+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 /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`
+RESET MASTER;
+DROP TABLE t1;

=== 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-06-01 23:25:08 +0000
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result	2010-06-30 15:25:13 +0000
@@ -110,8 +110,6 @@ delete from t2;
 reset master;
 insert into t1 values(9);
 insert into t2 select * from t1;
-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.
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
@@ -126,8 +124,6 @@ reset master;
 insert into t1 values(10);
 begin;
 insert into t2 select * from t1;
-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.
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
@@ -245,8 +241,6 @@ Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
 create table t0 (n int);
 insert t0 select * from t1;
-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.
 set autocommit=1;
 insert into t0 select GET_LOCK("lock1",null);
 Warnings:
@@ -288,7 +282,7 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert t1 values (1)
-master-bin.000001	#	Query	#	#	ROLLBACK
+master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; create table t0 (n int)
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; insert t0 select * from t1

=== modified file 'mysql-test/suite/funcs_1/r/is_engines_myisam.result'
--- a/mysql-test/suite/funcs_1/r/is_engines_myisam.result	2008-03-07 19:18:14 +0000
+++ b/mysql-test/suite/funcs_1/r/is_engines_myisam.result	2010-07-05 07:34:29 +0000
@@ -2,7 +2,7 @@ SELECT * FROM information_schema.engines
 WHERE ENGINE = 'MyISAM';
 ENGINE	MyISAM
 SUPPORT	DEFAULT
-COMMENT	Default engine as of MySQL 3.23 with great performance
+COMMENT	MyISAM storage engine
 TRANSACTIONS	NO
 XA	NO
 SAVEPOINTS	NO

=== modified file 'mysql-test/suite/ndb/r/ndb_binlog_format.result'
--- a/mysql-test/suite/ndb/r/ndb_binlog_format.result	2010-06-01 23:25:08 +0000
+++ b/mysql-test/suite/ndb/r/ndb_binlog_format.result	2010-06-30 15:25:13 +0000
@@ -8,8 +8,6 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
 INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2);
 INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c;
-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.
 START TRANSACTION;
 INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2);
 UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f;

=== modified file 'mysql-test/suite/ndb/t/disabled.def'
--- a/mysql-test/suite/ndb/t/disabled.def	2010-02-09 10:40:08 +0000
+++ b/mysql-test/suite/ndb/t/disabled.def	2010-07-02 06:23:00 +0000
@@ -10,8 +10,9 @@
 #
 ##############################################################################
 
-ndb_partition_error2      : Bug#40989 ndb_partition_error2 needs maintenance
+ndb_binlog_discover       : Bug#54851 2010-07-02 alik ndb.ndb_binlog_discover crashes the server
 ndb_condition_pushdown    : Bug#49746 2010-02-08 alik ndb_condition_pushdown fails in mysql-next-mr
+ndb_partition_error2      : Bug#40989 ndb_partition_error2 needs maintenance
 
 
 # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open

=== modified file 'mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result'
--- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result	2010-05-07 11:10:40 +0000
+++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result	2010-06-30 15:25:13 +0000
@@ -72,8 +72,6 @@ before call db1.p1()
 INSERT INTO db1.t2 VALUES ('before call db1.p2()');
 BEGIN;
 CALL db1.p2();
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 ROLLBACK;
 INSERT INTO db1.t2 VALUES ('after call db1.p2()');
 SELECT * FROM db1.t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_concurrency_error.result'
--- a/mysql-test/suite/rpl/r/rpl_concurrency_error.result	2010-06-01 23:25:08 +0000
+++ b/mysql-test/suite/rpl/r/rpl_concurrency_error.result	2010-06-30 15:25:13 +0000
@@ -29,8 +29,6 @@ UPDATE t SET f = 'magenta 2' WHERE f = '
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 INSERT INTO t VALUES (5 + (2 * 10),"brown");
 INSERT INTO n VALUES (now(),"brown");
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 COMMIT;
 ROLLBACK;
 Warnings:
@@ -58,8 +56,6 @@ UPDATE t SET f = 'dark blue 2' WHERE f =
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 INSERT INTO t VALUES (6 + (2 * 10),"brown");
 INSERT INTO n VALUES (now(),"brown");
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 COMMIT;
 COMMIT;
 show binlog events from <binlog_start>;
@@ -83,8 +79,6 @@ UPDATE t SET f = 'magenta 1' WHERE f = '
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 INSERT INTO t VALUES (5 + (1 * 10),"brown");
 INSERT INTO n VALUES (now(),"brown");
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 COMMIT;
 ROLLBACK;
 Warnings:
@@ -110,8 +104,6 @@ UPDATE t SET f = 'dark blue 1' WHERE f =
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 INSERT INTO t VALUES (6 + (1 * 10),"brown");
 INSERT INTO n VALUES (now(),"brown");
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 COMMIT;
 COMMIT;
 show binlog events from <binlog_start>;

=== modified file 'mysql-test/suite/rpl/r/rpl_drop_temp.result'
--- a/mysql-test/suite/rpl/r/rpl_drop_temp.result	2009-12-31 04:04:19 +0000
+++ b/mysql-test/suite/rpl/r/rpl_drop_temp.result	2010-06-29 10:54:58 +0000
@@ -26,3 +26,24 @@ CREATE TEMPORARY TABLE tmp3 (a int);
 DROP TEMPORARY TABLE tmp3;
 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
 START SLAVE;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 ( i INT );
+SHOW STATUS LIKE 'Slave_open_temp_tables';
+Variable_name	Value
+Slave_open_temp_tables	0
+CREATE TEMPORARY TABLE ttmp1 ( i INT );
+SET SESSION binlog_format=ROW;
+SHOW STATUS LIKE 'Slave_open_temp_tables';
+Variable_name	Value
+Slave_open_temp_tables	0
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 ( i INT )
+master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE ttmp1 ( i INT )
+master-bin.000001	#	Query	#	#	use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1`
+DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result	2010-04-28 12:47:49 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result	2010-06-30 15:25:13 +0000
@@ -19,7 +19,7 @@ SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
 START SLAVE SQL_THREAD;
 *** Single statement on both transactional and non-transactional tables. ***
 Got one of the listed errors
-SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
 START SLAVE SQL_THREAD;
 source include/diff_master_slave.inc;
 ########################################################################################

=== added 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	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result	2010-06-30 19:37:41 +0000
@@ -0,0 +1,1513 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+#########################################################################
+#                            CONFIGURATION
+#########################################################################
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+SET @commands= 'configure';
+CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb;
+CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
+Warnings:
+Note	1051	Unknown table 'nt_tmp_2'
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
+Warnings:
+Note	1051	Unknown table 'nt_tmp_1'
+CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
+Warnings:
+Note	1051	Unknown table 'tt_tmp_2'
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
+Warnings:
+Note	1051	Unknown table 'tt_tmp_1'
+CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS nt_2;
+Warnings:
+Note	1051	Unknown table 'nt_2'
+CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS nt_1;
+Warnings:
+Note	1051	Unknown table 'nt_1'
+CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS tt_2;
+Warnings:
+Note	1051	Unknown table 'tt_2'
+CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb;
+SET @commands= '';
+#########################################################################
+#           1 - Tables dropped by "DROP TEMPORARY TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+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
+-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
+-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';
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-Xe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+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
+-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';
+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
+-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';
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+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
+-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';
+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
+-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';
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+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
+-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
+-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
+-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
+-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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N 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`; 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 tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
+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-
+
+SET @commands= 'B T Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+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`; 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_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-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-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	#	Xid	#	#	COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-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 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-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-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 IF EXISTS tt_xx_1
+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-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-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 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	#	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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-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 tt_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-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-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 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	#	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-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-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 IF EXISTS tt_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-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-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 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	#	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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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`; 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_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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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`; 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	#	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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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`; 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 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	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+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`; 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	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C';
+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'
+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`; 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 tt_tmp_2, nt_tmp_2
+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-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-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 tt_tmp_1, tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-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 tt_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+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`; 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-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_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-T-Temp N 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`; 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 tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
+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-
+
+SET @commands= 'B T Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE 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-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`; 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_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-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-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	#	#	ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_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-Xe-Temp N Drop-Temp-Xe-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 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-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-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 IF EXISTS tt_xx_1
+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-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_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-If-Xe-Temp N Drop-Temp-If-Xe-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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-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 tt_tmp_2, tt_1
+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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_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-TXe-Temp N Drop-Temp-TXe-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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-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 IF EXISTS tt_tmp_2, tt_1
+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-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_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-If-TXe-Temp N Drop-Temp-If-TXe-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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_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-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`; 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_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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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`; 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_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-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`; 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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+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`; 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R';
+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'
+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`; 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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-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 tt_tmp_1, tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (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-TT-Temp N Drop-Temp-TT-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 tt_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (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-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`; 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-
+
+#########################################################################
+#                   2 - Tables dropped by "DROP TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+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
+-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
+-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';
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-Xe';
+DROP TABLE IF EXISTS xx_1;
+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
+-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';
+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
+-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';
+DROP TABLE IF EXISTS tt_2, xx_1;
+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
+-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';
+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
+-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';
+DROP TABLE IF EXISTS nt_2, xx_1;
+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
+-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
+-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
+-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
+-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
+-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
+-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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-T';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-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	#	#	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-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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-
+
+#########################################################################
+#                      3 - CREATE TEMPORARY TABLE
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+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`; 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
+-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';
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+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`; 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
+-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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+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`; 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	#	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-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+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`; 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	#	#	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-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+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`; 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	#	#	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-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+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`; 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	#	#	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-
+
+#########################################################################
+#                     4 -  CHANGING TEMPORARY TABLES
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-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 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	#	Query	#	#	COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C';
+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;
+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-
+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 nt_tmp_xx_1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (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-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+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	#	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-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+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-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	#	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-
+
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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	#	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-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R';
+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;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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-
+
+###################################################################################
+#                               CHECK CONSISTENCY
+###################################################################################
+#########################################################################
+#                           CLEAN
+#########################################################################
+SET @commands= 'clean';
+DROP TABLE IF EXISTS tt_xx_1;
+DROP TABLE IF EXISTS nt_xx_1;
+DROP TABLE IF EXISTS nt_2;
+DROP TABLE IF EXISTS nt_1;
+DROP TABLE IF EXISTS tt_2;
+DROP TABLE IF EXISTS tt_1;
+SET @commands= '';

=== modified file 'mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result'
--- a/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result	2010-05-07 09:37:16 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result	2010-06-30 15:25:13 +0000
@@ -393,15 +393,13 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, 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- >> 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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, 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-
 
@@ -409,15 +407,13 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1;
 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_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> nT << -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_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -425,23 +421,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_3)
-master-bin.000001	#	Update_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_3)
-master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NT << -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.nt_3)
-master-bin.000001	#	Update_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_3)
-master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -449,23 +435,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_4)
-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_4)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -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.nt_4)
-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_4)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -473,35 +449,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1));
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -509,23 +463,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_4)
-master-bin.000001	#	Update_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_4)
-master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -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- >> 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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_4)
-master-bin.000001	#	Update_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_4)
-master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -533,23 +477,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_3)
-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_3)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -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.nt_3)
-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_3)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -557,35 +491,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1));
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -604,15 +516,13 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, 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- >> tNe << -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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, 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-
 
@@ -630,16 +540,14 @@ INSERT INTO nt_4(trans_id, stmt_id) VALU
 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	#	Table_map	#	#	table_id: # (test.nt_4)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1)
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NeT-trig << -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.nt_4)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1)
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -647,20 +555,14 @@ INSERT INTO nt_5(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-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`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1))
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-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`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1))
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -668,16 +570,14 @@ INSERT INTO tt_3(trans_id, stmt_id) VALU
 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	#	Table_map	#	#	table_id: # (test.nt_3)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1)
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -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.nt_3)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1)
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -685,24 +585,14 @@ INSERT INTO tt_5(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-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`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1))
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-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`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1))
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -3711,8 +3601,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -3725,8 +3614,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4)
 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 (133, 2)
@@ -3745,10 +3633,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -3761,10 +3646,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4)
 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 (134, 2)
@@ -3785,12 +3667,7 @@ fc_i_nt_5_suc (135, 4)
 fc_i_nt_5_suc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(135,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -3803,12 +3680,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(135,4)
 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 (135, 2)
@@ -3827,16 +3699,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (136, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -3849,16 +3715,10 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',136),  NAME_CONST('in_stmt_id',1) + 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 (136, 2)
@@ -3877,8 +3737,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -3891,8 +3750,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (137, 2)
@@ -3911,10 +3769,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -3927,10 +3782,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (138, 2)
@@ -3951,12 +3803,7 @@ fc_i_nt_5_suc (139, 4)
 fc_i_nt_5_suc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(139,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -3969,12 +3816,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(139,4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (139, 2)
@@ -3993,16 +3835,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (140, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4015,16 +3851,10 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',140),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (140, 2)
@@ -4045,8 +3875,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4059,8 +3888,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_tt_5_suc`(141,2)
@@ -4081,10 +3909,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4097,10 +3922,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_tt_5_suc`(142,2)
@@ -4123,12 +3945,7 @@ fc_i_nt_5_suc (143, 4)
 fc_i_nt_5_suc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(143,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4141,12 +3958,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(143,4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_tt_5_suc`(143,2)
@@ -4167,16 +3979,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (144, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4189,16 +3995,10 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',144),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_tt_5_suc`(144,2)
@@ -4217,8 +4017,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4232,8 +4031,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',145),  NAME_CONST('in_stmt_id',1))
@@ -4253,10 +4051,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4270,10 +4065,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',146),  NAME_CONST('in_stmt_id',1))
@@ -4295,12 +4087,7 @@ fc_i_nt_5_suc (147, 4)
 fc_i_nt_5_suc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(147,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4314,12 +4101,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(147,4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',147),  NAME_CONST('in_stmt_id',1))
@@ -4339,16 +4121,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (148, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4362,16 +4138,10 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',148),  NAME_CONST('in_stmt_id',1))
@@ -4487,8 +4257,7 @@ INSERT INTO nt_1(trans_id, stmt_id) VALU
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (152, 4), (150, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> Ne << -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-
@@ -4501,8 +4270,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Ne 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (152, 4), (150, 4)
 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 (152, 2)
@@ -4531,8 +4299,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4544,8 +4311,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4561,10 +4327,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4576,10 +4339,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T N-trig R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4597,12 +4357,7 @@ fc_i_nt_5_suc (155, 4)
 fc_i_nt_5_suc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(155,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4614,12 +4369,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(155,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T N-func R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4635,16 +4385,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (156, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4656,16 +4400,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',156),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T N-proc R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4681,8 +4419,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4694,8 +4431,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4711,10 +4447,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4726,10 +4459,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-trig R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4747,12 +4477,7 @@ fc_i_nt_5_suc (159, 4)
 fc_i_nt_5_suc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(159,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4764,12 +4489,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(159,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-func R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4785,16 +4505,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (160, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4806,16 +4520,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-trig N-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',160),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-trig N-proc R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4833,8 +4541,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -4846,8 +4553,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-func N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4865,10 +4571,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -4880,10 +4583,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-trig R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4903,12 +4603,7 @@ fc_i_nt_5_suc (163, 4)
 fc_i_nt_5_suc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(163,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -4920,12 +4615,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(163,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-func R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4943,16 +4633,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (164, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -4964,16 +4648,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-func N-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',164),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-func N-proc R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -4989,8 +4667,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -5002,8 +4679,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -5019,10 +4695,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-trig << -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-
@@ -5034,10 +4707,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-trig R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -5055,12 +4725,7 @@ fc_i_nt_5_suc (167, 4)
 fc_i_nt_5_suc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(167,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-func << -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-
@@ -5072,12 +4737,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_nt_5_suc`(167,4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-func R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -5093,16 +4753,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (168, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -5114,16 +4768,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T-proc N-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',168),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T-proc N-proc R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -5233,8 +4881,7 @@ INSERT INTO nt_1(trans_id, stmt_id) VALU
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (172, 4), (170, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> Ne << -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-
@@ -5246,8 +4893,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B T Ne 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (172, 4), (170, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B T Ne R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -5673,16 +5319,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (185, 2);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -5699,16 +5339,10 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',185),  NAME_CONST('in_stmt_id',1) + 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 (185, 4)
@@ -5723,16 +5357,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (186, 2);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -5749,16 +5377,10 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',186),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES (186, 4)
@@ -5773,16 +5395,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (187, 2);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -5801,16 +5417,10 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',187),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; SELECT `test`.`fc_i_tt_5_suc`(187,4)
@@ -5825,16 +5435,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (188, 2);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
@@ -5852,16 +5456,10 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',188),  NAME_CONST('in_stmt_id',1))
@@ -6237,16 +5835,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (201, 2);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -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-
@@ -6262,16 +5854,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',201),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -6283,16 +5869,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (202, 2);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> T-proc << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6308,16 +5888,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-proc 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',202),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-proc R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -6329,16 +5903,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (203, 2);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> T-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6354,16 +5922,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-trig 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',203),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-trig R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -6375,16 +5937,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 CALL pc_i_nt_5_suc (204, 2);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> T-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6402,16 +5958,10 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B N-proc T-func 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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204),  NAME_CONST('in_stmt_id',1))
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id) VALUES ( NAME_CONST('p_trans_id',204),  NAME_CONST('in_stmt_id',1) + 1)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N-proc T-func R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -6434,8 +5984,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, 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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6452,8 +6001,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, 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 (205, 4)
@@ -6762,8 +6310,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, 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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6780,8 +6327,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B tNe T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, 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 (213, 4)
@@ -6986,8 +6532,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, 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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -7003,8 +6548,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B tN T R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -7240,8 +6784,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, 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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -7257,8 +6800,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tNe T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B tNe T R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -8439,8 +7981,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, 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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -8457,8 +7998,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (261, 4)
@@ -8477,8 +8017,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8492,8 +8031,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B nT N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_1)
@@ -8517,8 +8055,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8536,8 +8073,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Update_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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_3)
@@ -8561,8 +8097,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8580,8 +8115,7 @@ master-bin.000001	#	Table_map	#	#	table_
 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_4)
@@ -8607,8 +8141,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8632,8 +8165,7 @@ master-bin.000001	#	Write_rows	#	#	table
 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
@@ -8661,8 +8193,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8680,8 +8211,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Update_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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_4)
@@ -8705,8 +8235,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8724,8 +8253,7 @@ master-bin.000001	#	Table_map	#	#	table_
 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_3)
@@ -8753,8 +8281,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -8778,8 +8305,7 @@ master-bin.000001	#	Write_rows	#	#	table
 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
@@ -8810,8 +8336,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -8828,8 +8353,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tNe N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (269, 4)
@@ -9035,8 +8559,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, 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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9055,8 +8578,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (275, 4)
@@ -9075,8 +8597,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9088,8 +8609,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B nT N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B nT N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9109,8 +8629,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9126,8 +8645,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Update_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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B NT N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9147,8 +8665,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9164,8 +8681,7 @@ master-bin.000001	#	Table_map	#	#	table_
 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B NT-trig N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9187,8 +8703,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9206,8 +8721,7 @@ master-bin.000001	#	Write_rows	#	#	table
 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B NT-func N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9227,8 +8741,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9244,8 +8757,7 @@ master-bin.000001	#	Table_map	#	#	table_
 master-bin.000001	#	Update_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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B TN N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9265,8 +8777,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9282,8 +8793,7 @@ master-bin.000001	#	Table_map	#	#	table_
 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B TN-trig N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9307,8 +8817,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -9328,8 +8837,7 @@ master-bin.000001	#	Write_rows	#	#	table
 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B TN-func N R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9354,8 +8862,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9374,8 +8881,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tNe N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (283, 4)
@@ -9597,8 +9103,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 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-
@@ -9611,8 +9116,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (289, 2)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N tN C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9953,8 +9457,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, 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-
@@ -9967,8 +9470,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (297, 2)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N tNe C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -10177,8 +9679,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 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-
@@ -10193,8 +9694,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (303, 2)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N tN R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -10481,8 +9981,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, 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-
@@ -10497,8 +9996,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (311, 2)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N tNe R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -10792,8 +10290,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> S1 << -b-b-b-b-b-b-b-b-b-b-b-
@@ -10823,8 +10320,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T N S1 T R1 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4)
 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 (319, 2)
@@ -10850,8 +10346,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5)
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -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-
@@ -10877,8 +10372,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B T S1 N T R1 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5)
 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 (320, 2)
@@ -11931,8 +11425,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, 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- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11956,8 +11449,7 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN CT T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tt_xx_14 (a int) engine=Innodb

=== 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-05-07 09:37:16 +0000
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result	2010-06-30 15:25:13 +0000
@@ -393,15 +393,13 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, 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- >> 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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, 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-
 
@@ -409,15 +407,13 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1;
 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_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> nT << -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_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -425,23 +421,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_3)
-master-bin.000001	#	Update_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_3)
-master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NT << -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.nt_3)
-master-bin.000001	#	Update_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_3)
-master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -449,23 +435,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_4)
-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_4)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -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.nt_4)
-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_4)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -473,35 +449,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1));
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -509,23 +463,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_4)
-master-bin.000001	#	Update_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_4)
-master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -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- >> 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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_4)
-master-bin.000001	#	Update_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_4)
-master-bin.000001	#	Update_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -533,23 +477,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1);
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_3)
-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_3)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -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.nt_3)
-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_3)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 1)
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -557,35 +491,13 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1));
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-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	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.tt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
 master-bin.000001	#	Xid	#	#	COMMIT /* XID */
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -604,15 +516,13 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, 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- >> tNe << -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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 31, 1, COUNT(*) FROM tt_1 UNION SELECT 23, 1, 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-
 
@@ -630,16 +540,14 @@ INSERT INTO nt_4(trans_id, stmt_id) VALU
 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	#	Table_map	#	#	table_id: # (test.nt_4)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1)
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NeT-trig << -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.nt_4)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_4(trans_id, stmt_id) VALUES (33, 1), (26, 1)
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -647,20 +555,14 @@ INSERT INTO nt_5(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-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`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1))
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> NeT-func << -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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-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`; INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (34, 1, ''), (30, 2, fc_i_tt_5_suc (34, 1))
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -b-b-b-b-b-b-b-b-b-b-b-
@@ -668,16 +570,14 @@ INSERT INTO tt_3(trans_id, stmt_id) VALU
 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	#	Table_map	#	#	table_id: # (test.nt_3)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1)
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> TeN-trig << -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.nt_3)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-master-bin.000001	#	Query	#	#	COMMIT
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tt_3(trans_id, stmt_id) VALUES (35, 1), (29, 1)
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -b-b-b-b-b-b-b-b-b-b-b-
@@ -685,24 +585,14 @@ INSERT INTO tt_5(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-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`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1))
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> TeN-func << -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.nt_5)
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_6)
-master-bin.000001	#	Write_rows	#	#	table_id: #
-master-bin.000001	#	Write_rows	#	#	table_id: #
-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`; INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (36, 1, ''), (30, 1, fc_i_nt_5_suc (36, 1))
+master-bin.000001	#	Query	#	#	ROLLBACK
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
 
 
@@ -6434,8 +6324,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, 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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6452,8 +6341,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, 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 (205, 4)
@@ -6762,8 +6650,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, 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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -6780,8 +6667,7 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 -b-b-b-b-b-b-b-b-b-b-b- >> B tNe T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 213, 2, COUNT(*) FROM tt_1 UNION SELECT 205, 2, 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 (213, 4)
@@ -6986,8 +6872,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, 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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -7003,8 +6888,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B tN T R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -7240,8 +7124,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, 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- >> T << -b-b-b-b-b-b-b-b-b-b-b-
@@ -7257,8 +7140,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tNe T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 227, 2, COUNT(*) FROM tt_1 UNION SELECT 219, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B tNe T R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -8439,8 +8321,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, 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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -8457,8 +8338,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (261, 4)
@@ -8810,8 +8690,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -8828,8 +8707,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tNe N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 269, 2, COUNT(*) FROM tt_1 UNION SELECT 268, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (269, 4)
@@ -9035,8 +8913,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, 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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9055,8 +8932,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (275, 4)
@@ -9354,8 +9230,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
@@ -9374,8 +9249,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -b-b-b-b-b-b-b-b-b-b-b- >> B tNe N 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 283, 2, COUNT(*) FROM tt_1 UNION SELECT 282, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (283, 4)
@@ -9597,8 +9471,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 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-
@@ -9611,8 +9484,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (289, 2)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N tN C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -9953,8 +9825,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, 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-
@@ -9967,8 +9838,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (297, 2)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 297, 4, COUNT(*) FROM tt_1 UNION SELECT 297, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N tNe C << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -10177,8 +10047,7 @@ master-bin.000001	#	Query	#	#	COMMIT
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 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-
@@ -10193,8 +10062,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (303, 2)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N tN R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -10481,8 +10349,7 @@ INSERT INTO nt_1(trans_id, stmt_id, info
 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	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, 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-
@@ -10497,8 +10364,7 @@ master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id) VALUES (311, 2)
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 311, 4, COUNT(*) FROM tt_1 UNION SELECT 311, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> B N tNe R << -e-e-e-e-e-e-e-e-e-e-e-
 
@@ -11931,8 +11797,7 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Table_map	#	#	table_id: # (test.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, 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- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
@@ -11956,8 +11821,7 @@ master-bin.000001	#	Query	#	#	ROLLBACK
 -b-b-b-b-b-b-b-b-b-b-b- >> B tN CT T 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.nt_1)
-master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_1
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tt_xx_14 (a int) engine=Innodb

=== 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-06-01 23:25:08 +0000
+++ b/mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result	2010-06-30 15:25:13 +0000
@@ -391,8 +391,6 @@ master-bin.000001	#	Query	#	#	COMMIT
 #
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_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.
 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 23, 1, COUNT(*) FROM tt_1
@@ -407,8 +405,6 @@ master-bin.000001	#	Query	#	#	COMMIT
 
 -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_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.
 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, info) SELECT 24, 1, COUNT(*) FROM nt_1
@@ -423,8 +419,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b-
 UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 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.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
@@ -439,8 +433,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 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.
 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_4(trans_id, stmt_id) VALUES (26, 1)
@@ -455,8 +447,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 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.
 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_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
@@ -471,8 +461,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b-
 UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 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.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
@@ -487,8 +475,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 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.
 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_3(trans_id, stmt_id) VALUES (29, 1)
@@ -503,8 +489,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 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.
 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_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
@@ -6076,8 +6060,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_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.
 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 205, 2, COUNT(*) FROM tt_1
@@ -6518,8 +6500,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_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.
 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 219, 2, COUNT(*) FROM tt_1
@@ -7845,8 +7825,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_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.
 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 261, 2, COUNT(*) FROM tt_1
@@ -8311,8 +8289,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_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.
 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 275, 2, COUNT(*) FROM tt_1
@@ -8811,8 +8787,6 @@ master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_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.
 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 289, 4, COUNT(*) FROM tt_1
@@ -9297,8 +9271,6 @@ master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_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.
 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 303, 4, COUNT(*) FROM tt_1
@@ -10557,7 +10529,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;;
 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
@@ -10966,8 +10937,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_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.
 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 357, 2, COUNT(*) FROM tt_1

=== added 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	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result	2010-06-30 19:37:41 +0000
@@ -0,0 +1,1539 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+#########################################################################
+#                            CONFIGURATION
+#########################################################################
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+SET @commands= 'configure';
+CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb;
+CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
+Warnings:
+Note	1051	Unknown table 'nt_tmp_2'
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
+Warnings:
+Note	1051	Unknown table 'nt_tmp_1'
+CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
+Warnings:
+Note	1051	Unknown table 'tt_tmp_2'
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
+Warnings:
+Note	1051	Unknown table 'tt_tmp_1'
+CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS nt_2;
+Warnings:
+Note	1051	Unknown table 'nt_2'
+CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS nt_1;
+Warnings:
+Note	1051	Unknown table 'nt_1'
+CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS tt_2;
+Warnings:
+Note	1051	Unknown table 'tt_2'
+CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb;
+SET @commands= '';
+#########################################################################
+#           1 - Tables dropped by "DROP TEMPORARY TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+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 IF EXISTS `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 IF EXISTS `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';
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-Xe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+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
+-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';
+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 IF EXISTS `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';
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+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 */
+-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';
+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 IF EXISTS `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';
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+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` /* 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 */
+-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 IF EXISTS `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 IF EXISTS `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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	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	#	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-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N 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	#	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 `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-T-Temp N Drop-Temp-T-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+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	#	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-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+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	#	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_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-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-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	#	Xid	#	#	COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-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.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	#	Xid	#	#	COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-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	#	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-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-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.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	#	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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-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 `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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-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.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 `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-TXe-Temp N Drop-Temp-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-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 `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-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-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.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 `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-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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	#	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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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	#	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_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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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	#	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-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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	#	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_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-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+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	#	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	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C';
+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'
+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	#	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 `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	#	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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-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 `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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-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.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 `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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+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	#	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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+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	#	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-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_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-T-Temp N 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	#	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 `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-T-Temp N Drop-Temp-T-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+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	#	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-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE 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-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	#	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_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-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-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	#	#	ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_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-Xe-Temp N Drop-Temp-Xe-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.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	#	#	ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_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-If-Xe-Temp N Drop-Temp-If-Xe-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.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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-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 `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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_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-TXe-Temp N Drop-Temp-TXe-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.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 `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-TXe-Temp N Drop-Temp-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-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 `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-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_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-If-TXe-Temp N Drop-Temp-If-TXe-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.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 `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-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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	#	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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_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-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	#	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_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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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	#	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-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_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-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	#	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_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-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+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	#	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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R';
+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'
+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	#	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 `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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-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 `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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (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-TT-Temp N Drop-Temp-TT-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.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 `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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+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	#	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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (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-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	#	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-
+
+#########################################################################
+#                   2 - Tables dropped by "DROP TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+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
+-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
+-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';
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-Xe';
+DROP TABLE IF EXISTS xx_1;
+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
+-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';
+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
+-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';
+DROP TABLE IF EXISTS tt_2, xx_1;
+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
+-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';
+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
+-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';
+DROP TABLE IF EXISTS nt_2, xx_1;
+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
+-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
+-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
+-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
+-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 `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 */
+-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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-T';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-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	#	#	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-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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` /* 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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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 */
+-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-
+
+#########################################################################
+#                      3 - CREATE TEMPORARY TABLE
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+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 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 `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';
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+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 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` /* 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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+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	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+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 Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+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 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` /* 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-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+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	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `nt_tmp_1` /* generated by server */
+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 Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+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 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` /* 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-
+
+#########################################################################
+#                     4 -  CHANGING TEMPORARY TABLES
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-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.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.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 C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C';
+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;
+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-
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+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	#	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-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+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	#	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-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+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-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	#	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-
+
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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.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-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R';
+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;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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-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';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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 R << -e-e-e-e-e-e-e-e-e-e-e-
+
+###################################################################################
+#                               CHECK CONSISTENCY
+###################################################################################
+#########################################################################
+#                           CLEAN
+#########################################################################
+SET @commands= 'clean';
+DROP TABLE IF EXISTS tt_xx_1;
+DROP TABLE IF EXISTS nt_xx_1;
+DROP TABLE IF EXISTS nt_2;
+DROP TABLE IF EXISTS nt_1;
+DROP TABLE IF EXISTS tt_2;
+DROP TABLE IF EXISTS tt_1;
+SET @commands= '';

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result	2010-04-28 12:47:49 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result	2010-06-30 15:25:13 +0000
@@ -32,18 +32,12 @@ BEGIN;
 Got one of the listed errors
 Got one of the listed errors
 Got one of the listed errors
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 BEGIN;
 Got one of the listed errors
 Got one of the listed errors
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 BEGIN;
 Got one of the listed errors
 Got one of the listed errors
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 source include/diff_master_slave.inc;
 ########################################################################################
 #                                     3 - BEGIN - COMMIT
@@ -55,8 +49,6 @@ BEGIN;
 Got one of the listed errors
 Got one of the listed errors
 Got one of the listed errors
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 COMMIT;
 source include/diff_master_slave.inc;
 ########################################################################################
@@ -69,8 +61,6 @@ BEGIN;
 Got one of the listed errors
 Got one of the listed errors
 Got one of the listed errors
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 ROLLBACK;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -109,8 +99,6 @@ BEGIN;
 Got one of the listed errors
 Got one of the listed errors
 Got one of the listed errors
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 ROLLBACK TO sv;
 Warnings:
 Warning	1196	Some non-transactional changed tables couldn't be rolled back
@@ -123,19 +111,11 @@ TRUNCATE TABLE t1;
 TRUNCATE TABLE t2;
 TRUNCATE TABLE t3;
 BEGIN;
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Got one of the listed errors
 Got one of the listed errors
 Got one of the listed errors
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 COMMIT;
 BEGIN;
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 Got one of the listed errors
 COMMIT;
 source include/diff_master_slave.inc;

=== added 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	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result	2010-06-30 19:37:41 +0000
@@ -0,0 +1,1513 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+#########################################################################
+#                            CONFIGURATION
+#########################################################################
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+SET @commands= 'configure';
+CREATE TABLE tt_xx_1 ( id INT ) ENGINE = Innodb;
+CREATE TABLE nt_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE nt_tmp_xx_1 ( id INT ) ENGINE = MyIsam;
+CREATE TEMPORARY TABLE tt_tmp_xx_1 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2;
+Warnings:
+Note	1051	Unknown table 'nt_tmp_2'
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1;
+Warnings:
+Note	1051	Unknown table 'nt_tmp_1'
+CREATE TEMPORARY TABLE nt_tmp_1 ( id INT ) ENGINE = MyIsam;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2;
+Warnings:
+Note	1051	Unknown table 'tt_tmp_2'
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) ENGINE = Innodb;
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1;
+Warnings:
+Note	1051	Unknown table 'tt_tmp_1'
+CREATE TEMPORARY TABLE tt_tmp_1 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS nt_2;
+Warnings:
+Note	1051	Unknown table 'nt_2'
+CREATE TABLE nt_2 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS nt_1;
+Warnings:
+Note	1051	Unknown table 'nt_1'
+CREATE TABLE nt_1 ( id INT ) ENGINE = MyIsam;
+DROP TABLE IF EXISTS tt_2;
+Warnings:
+Note	1051	Unknown table 'tt_2'
+CREATE TABLE tt_2 ( id INT ) ENGINE = Innodb;
+DROP TABLE IF EXISTS tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+CREATE TABLE tt_1 ( id INT ) ENGINE = Innodb;
+SET @commands= '';
+#########################################################################
+#           1 - Tables dropped by "DROP TEMPORARY TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+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
+-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
+-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';
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-Temp-If-Xe-Temp';
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+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
+-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';
+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
+-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';
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+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
+-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';
+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
+-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';
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+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
+-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
+-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
+-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
+-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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-T-Temp N 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`; 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 tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
+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-
+
+SET @commands= 'B T Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1;
+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`; 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_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-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-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	#	Xid	#	#	COMMIT /* XID */
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-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 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-Xe-Temp N Drop-Temp-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-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 IF EXISTS tt_xx_1
+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-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-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 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	#	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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-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 tt_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-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-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 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	#	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-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-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 IF EXISTS tt_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-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-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 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	#	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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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`; 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_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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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`; 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	#	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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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`; 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 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	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+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`; 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	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp C';
+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'
+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`; 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 tt_tmp_2, nt_tmp_2
+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-TN-Temp N Drop-Temp-TN-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-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 tt_tmp_1, tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-Temp N Drop-Temp-TT-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 tt_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+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`; 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-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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`; INSERT INTO tt_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-T-Temp N Drop-Temp-T-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_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-T-Temp N 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`; 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 tt_tmp_2
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1
+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-
+
+SET @commands= 'B T Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-N-Temp N Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE 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-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`; 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_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-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-Xe-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	#	#	ROLLBACK
+-e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-Xe-Temp N Drop-Temp-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_xx_1;
+ERROR 42S02: Unknown table 'tt_xx_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-Xe-Temp N Drop-Temp-Xe-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 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-Xe-Temp N Drop-Temp-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-Xe-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 IF EXISTS tt_xx_1
+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-
+
+SET @commands= 'B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_xx_1;
+Warnings:
+Note	1051	Unknown table 'tt_xx_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-If-Xe-Temp N Drop-Temp-If-Xe-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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TXe-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 tt_tmp_2, tt_1
+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-
+
+SET @commands= 'B T Drop-Temp-TXe-Temp N Drop-Temp-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_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-TXe-Temp N Drop-Temp-TXe-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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-If-TXe-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 IF EXISTS tt_tmp_2, tt_1
+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-
+
+SET @commands= 'B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS tt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_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-If-TXe-Temp N Drop-Temp-If-TXe-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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-NXe-Temp N Drop-Temp-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2, tt_1;
+ERROR 42S02: Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, tt_1;
+ERROR 42S02: Unknown table 'tt_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-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`; 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_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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+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`; 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_2, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_1'
+INSERT INTO nt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE IF EXISTS nt_tmp_1, tt_1;
+Warnings:
+Note	1051	Unknown table 'tt_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-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`; 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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_2, nt_tmp_2;
+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`; 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TN-Temp N Drop-Temp-TN-Temp R';
+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'
+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`; 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 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	#	#	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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+ROLLBACK;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-Temp-TT-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 tt_tmp_1, tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-TT-Temp N Drop-Temp-TT-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (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-TT-Temp N Drop-Temp-TT-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 tt_xx_1() VALUES (1)
+master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tt_tmp_1, tt_tmp_2
+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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+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`; 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-
+
+SET @commands= 'B T Drop-Temp-NN-Temp N Drop-Temp-NN-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_1, nt_tmp_2;
+INSERT INTO nt_xx_1() VALUES (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-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`; 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-
+
+#########################################################################
+#                   2 - Tables dropped by "DROP TABLE"
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+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
+-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
+-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';
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> Drop-Xe << -b-b-b-b-b-b-b-b-b-b-b-
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+-e-e-e-e-e-e-e-e-e-e-e- >> Drop-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'Drop-If-Xe';
+DROP TABLE IF EXISTS xx_1;
+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
+-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';
+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
+-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';
+DROP TABLE IF EXISTS tt_2, xx_1;
+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
+-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';
+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
+-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';
+DROP TABLE IF EXISTS nt_2, xx_1;
+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
+-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
+-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
+-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
+-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
+-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
+-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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-T';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T Drop-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	#	#	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-Xe << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B T Drop-If-Xe';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS tt_2, xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_2, xx_1;
+ERROR 42S02: Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE IF EXISTS nt_2, xx_1;
+Warnings:
+Note	1051	Unknown table 'xx_1'
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_1, tt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE nt_1, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2, nt_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TABLE tt_tmp_2, nt_tmp_2;
+-b-b-b-b-b-b-b-b-b-b-b- >> B T 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	#	#	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
+-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-
+
+#########################################################################
+#                      3 - CREATE TEMPORARY TABLE
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp';
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+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`; 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
+-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';
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+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`; 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
+-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-
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp C';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+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`; 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	#	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-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp C';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+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`; 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	#	#	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-
+
+
+#
+#3) Generates in the binlog what follows:
+#
+SET @commands= 'B T Drop-Temp-N-Temp Create-N-Temp Drop-Temp-N-Temp Drop-Temp-N-Temp R';
+BEGIN;
+INSERT INTO tt_xx_1() VALUES (1);
+DROP TEMPORARY TABLE nt_tmp_2;
+CREATE TEMPORARY TABLE nt_tmp_2 ( id INT ) engine= MyIsam;
+DROP TEMPORARY TABLE nt_tmp_1;
+DROP TEMPORARY TABLE nt_tmp_2;
+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`; 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	#	#	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-
+
+SET @commands= 'B Drop-Temp-T-Temp Create-T-Temp Drop-Temp-T-Temp Drop-Temp-T-Temp R';
+BEGIN;
+DROP TEMPORARY TABLE tt_tmp_2;
+CREATE TEMPORARY TABLE tt_tmp_2 ( id INT ) engine= Innodb;
+DROP TEMPORARY TABLE tt_tmp_1;
+DROP TEMPORARY TABLE tt_tmp_2;
+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`; 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	#	#	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-
+
+#########################################################################
+#                     4 -  CHANGING TEMPORARY TABLES
+#########################################################################
+
+#
+#1) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+COMMIT;
+-b-b-b-b-b-b-b-b-b-b-b- >> B N N-Temp N-SELECT-N-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 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	#	Query	#	#	COMMIT
+-e-e-e-e-e-e-e-e-e-e-e- >> B N N-Temp N-SELECT-N-Temp N-Temp C << -e-e-e-e-e-e-e-e-e-e-e-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp C';
+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;
+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-
+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 nt_tmp_xx_1
+master-bin.000001	#	Query	#	#	use `test`; INSERT INTO nt_tmp_xx_1() VALUES (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-
+
+SET @commands= 'B N N-Temp N-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+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	#	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-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp C';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+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-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	#	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-
+
+
+
+#
+#2) Generates in the binlog what follows:
+#
+SET @commands= 'B N N-Temp N-SELECT-N-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM nt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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	#	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-
+
+SET @commands= 'B N N-Temp T-SELECT-N-Temp N-Temp R';
+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;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO nt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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-
+
+SET @commands= 'B N N-Temp T-SELECT-T-Temp N-Temp R';
+BEGIN;
+INSERT INTO nt_xx_1() VALUES (1);
+INSERT INTO nt_tmp_xx_1() VALUES (1);
+INSERT INTO tt_xx_1 SELECT * FROM tt_tmp_xx_1;
+INSERT INTO nt_tmp_xx_1() VALUES (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 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	#	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-
+
+###################################################################################
+#                               CHECK CONSISTENCY
+###################################################################################
+#########################################################################
+#                           CLEAN
+#########################################################################
+SET @commands= 'clean';
+DROP TABLE IF EXISTS tt_xx_1;
+DROP TABLE IF EXISTS nt_xx_1;
+DROP TABLE IF EXISTS nt_2;
+DROP TABLE IF EXISTS nt_1;
+DROP TABLE IF EXISTS tt_2;
+DROP TABLE IF EXISTS tt_1;
+SET @commands= '';

=== 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-01 23:25:08 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result	2010-06-30 15:25:13 +0000
@@ -391,8 +391,6 @@ master-bin.000001	#	Query	#	#	COMMIT
 #
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 23, 1, COUNT(*) FROM tt_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.
 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 23, 1, COUNT(*) FROM tt_1
@@ -407,8 +405,6 @@ master-bin.000001	#	Query	#	#	COMMIT
 
 -b-b-b-b-b-b-b-b-b-b-b- >> nT << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO tt_1(trans_id, stmt_id, info) SELECT 24, 1, COUNT(*) FROM nt_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.
 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, info) SELECT 24, 1, COUNT(*) FROM nt_1
@@ -423,8 +419,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> NT << -b-b-b-b-b-b-b-b-b-b-b-
 UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 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.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; UPDATE nt_3, tt_3 SET nt_3.info= "new text 25 --> 1", tt_3.info= "new text 25 --> 1" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1
@@ -439,8 +433,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> NT-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_4(trans_id, stmt_id) VALUES (26, 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.
 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_4(trans_id, stmt_id) VALUES (26, 1)
@@ -455,8 +447,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> NT-func << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 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.
 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_5(trans_id, stmt_id, info) VALUES (27, 1, fc_i_tt_5_suc(27, 1))
@@ -471,8 +461,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TN << -b-b-b-b-b-b-b-b-b-b-b-
 UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 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.
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	#	#	BEGIN
 master-bin.000001	#	Query	#	#	use `test`; UPDATE tt_4, nt_4 SET tt_4.info= "new text 28 --> 1", nt_4.info= "new text 28 --> 1" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1
@@ -487,8 +475,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TN-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO tt_3(trans_id, stmt_id) VALUES (29, 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.
 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_3(trans_id, stmt_id) VALUES (29, 1)
@@ -503,8 +489,6 @@ master-bin.000001	#	Xid	#	#	COMMIT /* XI
 
 -b-b-b-b-b-b-b-b-b-b-b- >> TN-func << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO tt_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 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.
 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_5(trans_id, stmt_id, info) VALUES (30, 1, fc_i_nt_5_suc(30, 1))
@@ -3615,8 +3599,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (133, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (133, 4)
@@ -3649,8 +3631,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (134, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_5(trans_id, stmt_id) VALUES (134, 4)
@@ -3755,8 +3735,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (137, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (137, 4)
@@ -3789,8 +3767,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (138, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_5(trans_id, stmt_id) VALUES (138, 4)
@@ -3897,8 +3873,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (141, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (141, 4)
@@ -3933,8 +3907,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (142, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_5(trans_id, stmt_id) VALUES (142, 4)
@@ -4043,8 +4015,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (145, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (145, 4)
@@ -4079,8 +4049,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (146, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_5(trans_id, stmt_id) VALUES (146, 4)
@@ -4329,8 +4297,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (153, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (153, 4)
@@ -4365,8 +4331,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (154, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_5(trans_id, stmt_id) VALUES (154, 4)
@@ -4477,8 +4441,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (157, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (157, 4)
@@ -4513,8 +4475,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (158, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_5(trans_id, stmt_id) VALUES (158, 4)
@@ -4627,8 +4587,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (161, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (161, 4)
@@ -4665,8 +4623,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (162, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_5(trans_id, stmt_id) VALUES (162, 4)
@@ -4781,8 +4737,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (165, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (165, 4)
@@ -4819,8 +4773,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T-proc << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N-trig << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_5(trans_id, stmt_id) VALUES (166, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_5(trans_id, stmt_id) VALUES (166, 4)
@@ -6244,8 +6196,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 205, 2, COUNT(*) FROM tt_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.
 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 205, 2, COUNT(*) FROM tt_1
@@ -6686,8 +6636,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 219, 2, COUNT(*) FROM tt_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.
 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 219, 2, COUNT(*) FROM tt_1
@@ -8029,8 +7977,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 261, 2, COUNT(*) FROM tt_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.
 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 261, 2, COUNT(*) FROM tt_1
@@ -8069,8 +8015,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (262, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (262, 4)
@@ -8105,8 +8049,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (263, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (263, 4)
@@ -8141,8 +8083,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (264, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (264, 4)
@@ -8177,8 +8117,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (265, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (265, 4)
@@ -8213,8 +8151,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (266, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (266, 4)
@@ -8249,8 +8185,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (267, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (267, 4)
@@ -8285,8 +8219,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (268, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (268, 4)
@@ -8392,8 +8324,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (271, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (271, 4)
@@ -8427,8 +8357,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (272, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (272, 4)
@@ -8462,8 +8390,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (273, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (273, 4)
@@ -8497,8 +8423,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (274, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (274, 4)
@@ -8539,8 +8463,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 275, 2, COUNT(*) FROM tt_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.
 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 275, 2, COUNT(*) FROM tt_1
@@ -8581,8 +8503,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> nT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (276, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (276, 4)
@@ -8619,8 +8539,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NT << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (277, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (277, 4)
@@ -8657,8 +8575,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (278, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (278, 4)
@@ -8695,8 +8611,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NT-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (279, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (279, 4)
@@ -8733,8 +8647,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -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- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (280, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (280, 4)
@@ -8771,8 +8683,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (281, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (281, 4)
@@ -8809,8 +8719,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> TN-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (282, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (282, 4)
@@ -8922,8 +8830,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (285, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (285, 4)
@@ -8959,8 +8865,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> NeT-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (286, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (286, 4)
@@ -8996,8 +8900,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-trig << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (287, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (287, 4)
@@ -9033,8 +8935,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> TeN-func << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (288, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (288, 4)
@@ -9083,8 +8983,6 @@ master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 289, 4, COUNT(*) FROM tt_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.
 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 289, 4, COUNT(*) FROM tt_1
@@ -9569,8 +9467,6 @@ master-bin.000001	#	Query	#	#	COMMIT
 -e-e-e-e-e-e-e-e-e-e-e- >> N << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 303, 4, COUNT(*) FROM tt_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.
 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 303, 4, COUNT(*) FROM tt_1
@@ -10158,8 +10054,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> T << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (319, 4);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (319, 4)
@@ -10216,8 +10110,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> S1 << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> N << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id) VALUES (320, 5);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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) VALUES (320, 5)
@@ -10845,7 +10737,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_xx_9(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;;
 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
@@ -10949,7 +10840,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 INSERT INTO nt_xx_10(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;;
 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 is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
 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_10(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1
@@ -11262,8 +11152,6 @@ Log_name	Pos	Event_type	Server_id	End_lo
 -e-e-e-e-e-e-e-e-e-e-e- >> B << -e-e-e-e-e-e-e-e-e-e-e-
 -b-b-b-b-b-b-b-b-b-b-b- >> tN << -b-b-b-b-b-b-b-b-b-b-b-
 INSERT INTO nt_1(trans_id, stmt_id, info) SELECT 357, 2, COUNT(*) FROM tt_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.
 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 357, 2, COUNT(*) FROM tt_1

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result	2010-06-01 23:25:08 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result	2010-06-30 15:25:13 +0000
@@ -52,8 +52,6 @@ include/start_slave.inc
 set @@global.debug="+d,stop_slave_middle_group";
 set @@global.debug="+d,incomplete_group_in_relay_log";
 update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
-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.
 SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`;
 Last_SQL_Error	true
 Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details).	1

=== removed file 'mysql-test/suite/rpl/r/rpl_temp_temporary.result'
--- a/mysql-test/suite/rpl/r/rpl_temp_temporary.result	2010-06-01 23:25:08 +0000
+++ b/mysql-test/suite/rpl/r/rpl_temp_temporary.result	1970-01-01 00:00:00 +0000
@@ -1,240 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-########################################################################
-#                         VERIFY ITEMS 1 and 2
-########################################################################
-#
-# Create temporary tables to verify when statements involving temporary
-# tables are classified as safe or unsafe by printing out the warning
-# messages.
-#
-CREATE TABLE t_myisam(id int) engine= MyIsam;
-INSERT INTO t_myisam VALUES(1);
-CREATE TABLE t_innodb(id int) engine= Innodb;
-INSERT INTO t_innodb VALUES(1);
-CREATE TEMPORARY TABLE t_myisam_temp(id int) engine= MyIsam;
-INSERT INTO t_myisam_temp VALUES(1);
-CREATE TEMPORARY TABLE t_innodb_temp(id int) engine= Innodb;
-INSERT INTO t_innodb_temp VALUES(1);
-BEGIN;
-INSERT INTO t_myisam SELECT * FROM t_myisam_temp;
-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 t_innodb SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_innodb_temp;
-ROLLBACK;
-Warnings:
-Warning	1196	Some non-transactional changed tables couldn't be rolled back
-BEGIN;
-INSERT INTO t_myisam SELECT * FROM t_innodb_temp;
-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 t_innodb SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_innodb_temp;
-ROLLBACK;
-Warnings:
-Warning	1196	Some non-transactional changed tables couldn't be rolled back
-########################################################################
-#                          VERIFY ITEM 3
-########################################################################
-#
-# When there is a temporary table we can switch between the mixed and
-# row formats. However, we cannot switch to the statement format.
-#
-SET BINLOG_FORMAT=MIXED;
-SET BINLOG_FORMAT=ROW;
-SET BINLOG_FORMAT=MIXED;
-SET BINLOG_FORMAT=STATEMENT;
-ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables
-#
-# When there is a temporary table we can switch between the mixed and
-# row formats. However, we cannot swith to the statement format.
-#
-SET BINLOG_FORMAT=MIXED;
-DROP TABLE t_myisam_temp, t_innodb_temp, t_myisam, t_innodb;
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_myisam SELECT * FROM t_myisam_temp
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_innodb SELECT * FROM t_myisam_temp
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_innodb SELECT * FROM t_innodb_temp
-master-bin.000001	#	Query	#	#	ROLLBACK
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_myisam SELECT * FROM t_innodb_temp
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_innodb SELECT * FROM t_myisam_temp
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_innodb SELECT * FROM t_innodb_temp
-master-bin.000001	#	Query	#	#	ROLLBACK
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t_myisam`,`t_innodb` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `t_myisam_temp`,`t_innodb_temp` /* generated by server */
-########################################################################
-#                          VERIFY ITEMS 4 and 5
-########################################################################
-#
-BEGIN;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-INSERT INTO tmp1 VALUES(1);
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-INSERT INTO tmp2 VALUES(1);
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp1;
-DROP TEMPORARY TABLE tmp2;
-DROP TEMPORARY TABLE tmp3;
-COMMIT;
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tmp1 VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tmp2 VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tmp3 VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tmp1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tmp2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tmp3
-master-bin.000001	#	Query	#	#	COMMIT
-BEGIN;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-INSERT INTO tmp1 VALUES(1);
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-INSERT INTO tmp2 VALUES(1);
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp1;
-DROP TEMPORARY TABLE tmp2;
-DROP TEMPORARY TABLE tmp3;
-ROLLBACK;
-Warnings:
-Warning	1196	Some non-transactional changed tables couldn't be rolled back
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tmp1 VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tmp2 VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tmp3 VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tmp1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tmp2
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE tmp3
-master-bin.000001	#	Query	#	#	ROLLBACK
-########################################################################
-#                          VERIFY ITEM 6
-########################################################################
-SET BINLOG_FORMAT=STATEMENT;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-SET BINLOG_FORMAT=ROW;
-DROP TEMPORARY TABLE tmp1;
-BEGIN;
-INSERT INTO tmp2 VALUES(1);
-DROP TEMPORARY TABLE tmp2;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp3;
-COMMIT;
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp3` /* generated by server */
-master-bin.000001	#	Query	#	#	COMMIT
-SET BINLOG_FORMAT=STATEMENT;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-SET BINLOG_FORMAT=ROW;
-DROP TEMPORARY TABLE tmp1;
-BEGIN;
-INSERT INTO tmp2 VALUES(1);
-DROP TEMPORARY TABLE tmp2;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp3;
-ROLLBACK;
-Warnings:
-Warning	1196	Some non-transactional changed tables couldn't be rolled back
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp2 LIKE tmp1
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp1` /* generated by server */
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp2` /* generated by server */
-master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tmp3` /* generated by server */
-master-bin.000001	#	Query	#	#	ROLLBACK
-########################################################################
-#                          VERIFY ITEM 7
-########################################################################
-SET BINLOG_FORMAT=STATEMENT;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM;
-CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb;
-BEGIN;
-INSERT INTO t_myisam VALUES(CONNECTION_ID());
-INSERT INTO tmp1 VALUES(1);
-INSERT INTO t_myisam VALUES(1);
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
-INSERT INTO t_innodb VALUES(1);
-INSERT INTO t_myisam VALUES(CONNECTION_ID());
-Warnings:
-Note	1592	Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction.
-INSERT INTO t_innodb VALUES(1);
-COMMIT;
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam
-master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM
-master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_myisam VALUES(CONNECTION_ID())
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_myisam VALUES(1)
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_myisam VALUES(CONNECTION_ID())
-master-bin.000001	#	Query	#	#	COMMIT
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO tmp1 VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_innodb VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_innodb VALUES(1)
-master-bin.000001	#	Xid	#	#	COMMIT /* XID */
-########################################################################
-#                           VERIFY ITEM 8
-########################################################################
-SET BINLOG_FORMAT=MIXED;
-BEGIN;
-CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb;
-INSERT INTO t_innodb VALUES(1);
-INSERT INTO t_innodb VALUES(1);
-ROLLBACK;
-Warnings:
-Warning	1196	Some non-transactional changed tables couldn't be rolled back
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	BEGIN
-master-bin.000001	#	Query	#	#	use `test`; CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_innodb VALUES(1)
-master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t_innodb VALUES(1)
-master-bin.000001	#	Query	#	#	ROLLBACK
-###################################################################################
-#                               CHECK CONSISTENCY
-###################################################################################
-###################################################################################
-#                                    CLEAN UP
-###################################################################################
-DROP TABLE t_myisam;
-DROP TABLE t_innodb;

=== modified file 'mysql-test/suite/rpl/t/rpl_drop_temp.test'
--- a/mysql-test/suite/rpl/t/rpl_drop_temp.test	2009-12-31 04:04:19 +0000
+++ b/mysql-test/suite/rpl/t/rpl_drop_temp.test	2010-06-29 10:54:58 +0000
@@ -66,4 +66,32 @@ START SLAVE;
 connection master;
 sync_slave_with_master;
 
+
+#
+# BUG#54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW
+#
+
+-- connection master
+-- source include/master-slave-reset.inc
+-- connection master
+
+CREATE TABLE t1 ( i INT );
+--sync_slave_with_master
+SHOW STATUS LIKE 'Slave_open_temp_tables';
+
+--connect(con1,localhost,root,,)
+CREATE TEMPORARY TABLE ttmp1 ( i INT );
+SET SESSION binlog_format=ROW;
+--disconnect con1
+
+-- connection master
+--let $wait_binlog_event= DROP
+--source include/wait_for_binlog_event.inc
+--sync_slave_with_master
+SHOW STATUS LIKE 'Slave_open_temp_tables';
+
+--connection master
+--source include/show_binlog_events.inc
+DROP TABLE t1;
+
 # End of 4.1 tests

=== added file 'mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test'
--- a/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mixed_drop_create_temp_table.test	2010-06-30 19:37:41 +0000
@@ -0,0 +1,10 @@
+###################################################################################
+# This test cases evaluates the mixture of non-transactional and transcational
+# tables. Specifically when drop temporary tables and create temporary tables
+# are used.
+###################################################################################
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source extra/rpl_tests/rpl_drop_create_temp_table.test

=== modified file 'mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test'
--- a/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test	2010-03-31 13:49:20 +0000
+++ b/mysql-test/suite/rpl/t/rpl_non_direct_mixed_mixing_engines.test	2010-06-30 15:25:13 +0000
@@ -11,5 +11,3 @@ SET SESSION binlog_direct_non_transactio
 --enable_query_log
 let $engine_type=Innodb;
 --source extra/rpl_tests/rpl_mixing_engines.test
-
---diff_files suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result suite/rpl/r/rpl_mixed_mixing_engines.result

=== added file 'mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test'
--- a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test	2010-06-30 19:37:41 +0000
@@ -0,0 +1,10 @@
+###################################################################################
+# This test cases evaluates the mixture of non-transactional and transcational
+# tables. Specifically when drop temporary tables and create temporary tables
+# are used.
+###################################################################################
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source extra/rpl_tests/rpl_drop_create_temp_table.test

=== added file 'mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_drop_create_temp_table.test	2010-06-30 19:37:41 +0000
@@ -0,0 +1,10 @@
+###################################################################################
+# This test cases evaluates the mixture of non-transactional and transcational
+# tables. Specifically when drop temporary tables and create temporary tables
+# are used.
+###################################################################################
+--source include/have_binlog_format_statement.inc
+--source include/master-slave.inc
+--source include/have_innodb.inc
+
+--source extra/rpl_tests/rpl_drop_create_temp_table.test

=== removed file 'mysql-test/suite/rpl/t/rpl_temp_temporary-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_temp_temporary-master.opt	2010-06-20 20:43:34 +0000
+++ b/mysql-test/suite/rpl/t/rpl_temp_temporary-master.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---default-storage-engine=MyISAM

=== removed file 'mysql-test/suite/rpl/t/rpl_temp_temporary.test'
--- a/mysql-test/suite/rpl/t/rpl_temp_temporary.test	2010-06-01 14:39:07 +0000
+++ b/mysql-test/suite/rpl/t/rpl_temp_temporary.test	1970-01-01 00:00:00 +0000
@@ -1,228 +0,0 @@
-################################################################################
-# BUG#51894 Replication failure with SBR on DROP TEMPORARY TABLE inside a
-#           transaction
-# BUG#52616 Temp table prevents switch binlog format from STATEMENT to ROW
-#
-# This test verifies what follows:
-#
-# 1 - If the following statements are classified as unsafe:
-#   1.1 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
-#   1.2 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
-#
-# 2 - If the following statements are classified as safe:
-#   1.7 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp
-#   1.8 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb
-#
-# 3 - If we can switch from statement to row format.
-#
-# 4 - If statements that can manipulate a temporary table and do not cause an
-# implicit commit are kept in the boundaries of an on-going transaction. For
-# instance:
-#   4.1 - CREATE TEMPORARY TABLE
-#   4.2 - CREATE TEMPORARY TABLE LIKE
-#   4.3 - CREATE TEMPORARY TABLE SELECT * FROM
-#   4.4 - INSERT/UPDATE/DELETE (Note that only inserts are verified)
-#   4.5 - INSERT INTO t_myisam SELECT * FROM t_myisam_temp
-#   4.6 - INSERT INTO t_myisam_temp SELECT * FROM t_myisam
-#   4.7 - INSERT INTO t_innodb SELECT * FROM t_myisam_temp
-#   4.8 - INSERT INTO t_myisam_temp SELECT * FROM t_innodb
-#
-# 5 - If transactions that have a DROP TEMPORARY are always written to the 
-# binary log regardless of the mode and the outcome: commit or rollback.
-#
-# 6 - In particular, if the current statement logging format is set to row
-# the CREATE TEMPORARY is not logged and the DROP TEMPORARY is extended with
-# the IF EXISTS clause.
-#
-# 7 - It verifies if the CONNECTION_ID along with a non-transactional
-# table is written outside the transaction boundaries and is not classified
-# as unsafe. See BUG#53075.
-#
-# 8 - It verifies if OPTION_KEEP_LOG is set and thus forcing to write the
-# trx-cache to the binary log when an rollback is issued and only trx-tables
-# were updated. See BUG#53421.
-################################################################################
-
-source include/master-slave.inc;
-source include/have_binlog_format_statement.inc;
-source include/have_innodb.inc;
-
-CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
-
---echo ########################################################################
---echo #                         VERIFY ITEMS 1 and 2
---echo ########################################################################
-
---echo #
---echo # Create temporary tables to verify when statements involving temporary
---echo # tables are classified as safe or unsafe by printing out the warning
---echo # messages.
---echo #
-connection master;
-CREATE TABLE t_myisam(id int) engine= MyIsam;
-INSERT INTO t_myisam VALUES(1);
-CREATE TABLE t_innodb(id int) engine= Innodb;
-INSERT INTO t_innodb VALUES(1);
-CREATE TEMPORARY TABLE t_myisam_temp(id int) engine= MyIsam;
-INSERT INTO t_myisam_temp VALUES(1);
-CREATE TEMPORARY TABLE t_innodb_temp(id int) engine= Innodb;
-INSERT INTO t_innodb_temp VALUES(1);
-
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-BEGIN;
-INSERT INTO t_myisam SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_innodb_temp;
-ROLLBACK;
-
-BEGIN;
-INSERT INTO t_myisam SELECT * FROM t_innodb_temp;
-INSERT INTO t_innodb SELECT * FROM t_myisam_temp;
-INSERT INTO t_innodb SELECT * FROM t_innodb_temp;
-ROLLBACK;
-
---echo ########################################################################
---echo #                          VERIFY ITEM 3
---echo ########################################################################
-
---echo #
---echo # When there is a temporary table we can switch between the mixed and
---echo # row formats. However, we cannot switch to the statement format.
---echo #
-SET BINLOG_FORMAT=MIXED;
-SET BINLOG_FORMAT=ROW;
-SET BINLOG_FORMAT=MIXED;
---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
-SET BINLOG_FORMAT=STATEMENT;
-
---echo #
---echo # When there is a temporary table we can switch between the mixed and
---echo # row formats. However, we cannot swith to the statement format.
---echo #
-SET BINLOG_FORMAT=MIXED;
-DROP TABLE t_myisam_temp, t_innodb_temp, t_myisam, t_innodb;
-source include/show_binlog_events.inc;
-
---echo ########################################################################
---echo #                          VERIFY ITEMS 4 and 5
---echo ########################################################################
-
---echo #
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-BEGIN;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-INSERT INTO tmp1 VALUES(1);
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-INSERT INTO tmp2 VALUES(1);
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp1;
-DROP TEMPORARY TABLE tmp2;
-DROP TEMPORARY TABLE tmp3;
-COMMIT;
-source include/show_binlog_events.inc;
-
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-BEGIN;
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-INSERT INTO tmp1 VALUES(1);
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-INSERT INTO tmp2 VALUES(1);
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp1;
-DROP TEMPORARY TABLE tmp2;
-DROP TEMPORARY TABLE tmp3;
-ROLLBACK;
-source include/show_binlog_events.inc;
-
---echo ########################################################################
---echo #                          VERIFY ITEM 6
---echo ########################################################################
-
-SET BINLOG_FORMAT=STATEMENT;
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-SET BINLOG_FORMAT=ROW;
-DROP TEMPORARY TABLE tmp1;
-BEGIN;
-INSERT INTO tmp2 VALUES(1);
-DROP TEMPORARY TABLE tmp2;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp3;
-COMMIT;
-source include/show_binlog_events.inc;
-
-SET BINLOG_FORMAT=STATEMENT;
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TEMPORARY TABLE tmp2 LIKE tmp1;
-CREATE TEMPORARY TABLE tmp3 engine= MyIsam SELECT * FROM tmp1;
-SET BINLOG_FORMAT=ROW;
-DROP TEMPORARY TABLE tmp1;
-BEGIN;
-INSERT INTO tmp2 VALUES(1);
-DROP TEMPORARY TABLE tmp2;
-INSERT INTO tmp3 VALUES(1);
-DROP TEMPORARY TABLE tmp3;
-ROLLBACK;
-source include/show_binlog_events.inc;
-
---echo ########################################################################
---echo #                          VERIFY ITEM 7
---echo ########################################################################
-
-SET BINLOG_FORMAT=STATEMENT;
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-
-CREATE TEMPORARY TABLE tmp1(id int) engine= MyIsam;
-CREATE TABLE t_myisam (f1 BIGINT) ENGINE = MyISAM;
-CREATE TABLE t_innodb (f1 BIGINT) ENGINE = Innodb;
-
-BEGIN;
-INSERT INTO t_myisam VALUES(CONNECTION_ID());
-INSERT INTO tmp1 VALUES(1);
-INSERT INTO t_myisam VALUES(1);
-INSERT INTO t_innodb VALUES(1);
-INSERT INTO t_myisam VALUES(CONNECTION_ID());
-INSERT INTO t_innodb VALUES(1);
-COMMIT;
-source include/show_binlog_events.inc;
-
---echo ########################################################################
---echo #                           VERIFY ITEM 8
---echo ########################################################################
-#
-# Before the patch for BUG#53421, nothing were written to the binary log on
-# behalf of the transaction presented below:
-#
-SET BINLOG_FORMAT=MIXED;
-let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
-BEGIN;
-CREATE TEMPORARY TABLE tmp2 SELECT * FROM t_innodb;
-INSERT INTO t_innodb VALUES(1);
-INSERT INTO t_innodb VALUES(1);
-ROLLBACK;
-source include/show_binlog_events.inc;
-
---echo ###################################################################################
---echo #                               CHECK CONSISTENCY
---echo ###################################################################################
-sync_slave_with_master;
-connection master;
-
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql
---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
---diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
-
---echo ###################################################################################
---echo #                                    CLEAN UP
---echo ###################################################################################
-connection master;
-
-DROP TABLE t_myisam;
-DROP TABLE t_innodb;
-
-sync_slave_with_master;

=== modified file 'mysql-test/suite/rpl_ndb/t/disabled.def'
--- a/mysql-test/suite/rpl_ndb/t/disabled.def	2009-07-06 15:17:39 +0000
+++ b/mysql-test/suite/rpl_ndb/t/disabled.def	2010-07-02 06:23:00 +0000
@@ -10,5 +10,8 @@
 #
 ##############################################################################
 
+rpl_ndb_stm_innodb  : Bug#54850 2010-07-02 alik rpl_ndb.rpl_ndb_stm_innodb and rpl_ndb.rpl_ndb_2other fails
+rpl_ndb_2other      : Bug#54850 2010-07-02 alik rpl_ndb.rpl_ndb_stm_innodb and rpl_ndb.rpl_ndb_2other fails
+
 # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
 rpl_ndb_2ndb   : Bug#45974: rpl_ndb_2ndb fails sporadically

=== modified file 'mysql-test/suite/sys_vars/r/large_files_support_basic.result'
--- a/mysql-test/suite/sys_vars/r/large_files_support_basic.result	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/r/large_files_support_basic.result	2010-07-06 13:06:07 +0000
@@ -1,20 +1,20 @@
 select @@global.large_files_support;
 @@global.large_files_support
-0
+1
 select @@session.large_files_support;
 ERROR HY000: Variable 'large_files_support' is a GLOBAL variable
 show global variables like 'large_files_support';
 Variable_name	Value
-large_files_support	OFF
+large_files_support	ON
 show session variables like 'large_files_support';
 Variable_name	Value
-large_files_support	OFF
+large_files_support	ON
 select * from information_schema.global_variables where variable_name='large_files_support';
 VARIABLE_NAME	VARIABLE_VALUE
-LARGE_FILES_SUPPORT	OFF
+LARGE_FILES_SUPPORT	ON
 select * from information_schema.session_variables where variable_name='large_files_support';
 VARIABLE_NAME	VARIABLE_VALUE
-LARGE_FILES_SUPPORT	OFF
+LARGE_FILES_SUPPORT	ON
 set global large_files_support=1;
 ERROR HY000: Variable 'large_files_support' is a read only variable
 set session large_files_support=1;

=== modified file 'mysql-test/suite/sys_vars/r/sql_select_limit_func.result'
--- a/mysql-test/suite/sys_vars/r/sql_select_limit_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/sql_select_limit_func.result	2010-07-08 12:36:10 +0000
@@ -62,6 +62,16 @@ a	b	a	b
 6	val6	6	val6
 affected rows: 2
 Expecting affected rows: 2
+SET SESSION sql_select_limit = 0;
+affected rows: 0
+SELECT * FROM t1;
+a	b
+affected rows: 0
+Expecting affected rows: 0
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+a	b	a	b
+affected rows: 0
+Expecting affected rows: 0
 '#-----------------------------FN_DYNVARS_165_03---------------#'
 SET SESSION sql_select_limit = 2;
 affected rows: 0

=== modified file 'mysql-test/suite/sys_vars/t/sql_select_limit_func.test'
--- a/mysql-test/suite/sys_vars/t/sql_select_limit_func.test	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/sql_select_limit_func.test	2010-07-08 12:36:10 +0000
@@ -86,6 +86,14 @@ SELECT * FROM t1;
 SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
 --echo Expecting affected rows: 2
 
+SET SESSION sql_select_limit = 0;
+
+SELECT * FROM t1;
+--echo Expecting affected rows: 0
+
+SELECT * FROM t1 INNER JOIN t2 ON t1.a = t2.a;
+--echo Expecting affected rows: 0
+
 --echo '#-----------------------------FN_DYNVARS_165_03---------------#'
 #
 # Small value with LIMIT Clause

=== modified file 'mysql-test/t/bug46080-master.opt'
--- a/mysql-test/t/bug46080-master.opt	2010-01-12 01:47:27 +0000
+++ b/mysql-test/t/bug46080-master.opt	2010-07-08 21:20:08 +0000
@@ -1 +1 @@
---loose-performance-schema=0 --skip-grant-tables --skip-name-resolve --loose-safemalloc-mem-limit=4000000
+--loose-performance-schema=0 --skip-grant-tables --skip-name-resolve

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2010-06-07 08:47:04 +0000
+++ b/mysql-test/t/disabled.def	2010-06-30 09:27:38 +0000
@@ -10,9 +10,10 @@
 #
 ##############################################################################
 kill                     : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
-query_cache_28249        : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
-sp_sync                  : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution
-plugin_load              : Bug#42144 2009-12-21 alik plugin_load fails
-partition_innodb_plugin  : Bug#53307 2010-04-30 VasilDimov valgrind warnings
+lowercase_table3         : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX
 mysqlhotcopy_myisam      : bug#54129 2010-06-04 Horst
 mysqlhotcopy_archive     : bug#54129 2010-06-04 Horst
+plugin_load              : Bug#42144 2009-12-21 alik plugin_load fails
+partition_innodb_plugin  : Bug#53307 2010-04-30 VasilDimov valgrind warnings
+query_cache_28249        : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
+sp_sync                  : Bug#48157 2010-02-06 5.5-m3 demands a differnt solution

=== renamed file 'mysql-test/t/analyse.test' => 'mysql-test/t/func_analyse.test'
=== modified file 'mysql-test/t/func_digest.test'
--- a/mysql-test/t/func_digest.test	2010-04-13 15:04:45 +0000
+++ b/mysql-test/t/func_digest.test	2010-07-07 06:38:11 +0000
@@ -481,3 +481,16 @@ SELECT LENGTH(SHA2( '', 224 )) / 2 * 8  
 SELECT LENGTH(SHA2( 'any', 256 )) / 2 * 8        = 256;
 SELECT LENGTH(SHA2( 'size', 384 )) / 2 * 8       = 384;
 SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8   = 512;
+
+--echo #
+--echo # Bug#54661 sha2() returns BINARY result
+--echo #
+--enable_metadata
+SET NAMES binary;
+SELECT sha2('1',224);
+SET NAMES utf8;
+SELECT sha2('1',224);
+SET NAMES latin1;
+SELECT sha2('1',224);
+--disable_metadata
+

=== modified file 'mysql-test/t/innodb_mysql_lock2.test'
--- a/mysql-test/t/innodb_mysql_lock2.test	2010-06-17 13:31:51 +0000
+++ b/mysql-test/t/innodb_mysql_lock2.test	2010-06-30 15:25:13 +0000
@@ -12,6 +12,10 @@
 # Save the initial number of concurrent sessions.
 --source include/count_sessions.inc
 
+--disable_query_log
+CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+--enable_query_log
+
 --echo #
 --echo # Test how do we handle locking in various cases when
 --echo # we read data from InnoDB tables.

=== removed file 'mysql-test/t/mysql-bug45236-master.opt'
--- a/mysql-test/t/mysql-bug45236-master.opt	2009-12-22 09:35:56 +0000
+++ b/mysql-test/t/mysql-bug45236-master.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---loose-skip-safemalloc

=== modified file 'mysql-test/t/partition_innodb.test'
--- a/mysql-test/t/partition_innodb.test	2010-06-17 20:51:35 +0000
+++ b/mysql-test/t/partition_innodb.test	2010-07-06 17:38:03 +0000
@@ -452,3 +452,19 @@ SELECT * FROM t1;
 COMMIT;
 DROP TABLE t1;
 --enable_parsing
+
+--echo #
+--echo # Bug#54783: optimize table crashes with invalid timestamp default value and NO_ZERO_DATE
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT, b TIMESTAMP DEFAULT '0000-00-00 00:00:00')
+  ENGINE=INNODB PARTITION BY LINEAR HASH (a) PARTITIONS 1;
+SET @old_mode = @@sql_mode;
+SET SESSION sql_mode = 'NO_ZERO_DATE';
+OPTIMIZE TABLE t1;
+SET SESSION sql_mode = @old_mode;
+DROP TABLE t1;

=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test	2010-04-29 20:33:06 +0000
+++ b/mysql-test/t/select.test	2010-07-08 13:19:05 +0000
@@ -4118,3 +4118,26 @@ DROP TABLE t1;
 
 
 --echo End of 5.1 tests
+
+--echo #
+--echo # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on 
+--echo #            SELECT from VIEW with GROUP BY
+--echo #
+
+CREATE TABLE t1 (
+  col_int_key int DEFAULT NULL,
+  KEY int_key (col_int_key)
+) ;
+
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE VIEW view_t1 AS 
+  SELECT t1.col_int_key AS col_int_key
+  FROM t1;
+
+SELECT col_int_key FROM view_t1 GROUP BY col_int_key;
+
+DROP VIEW view_t1;
+DROP TABLE t1;
+
+--echo # End of test BUG#54515

=== modified file 'mysql-test/t/sp_trans_log.test'
--- a/mysql-test/t/sp_trans_log.test	2010-05-26 14:34:25 +0000
+++ b/mysql-test/t/sp_trans_log.test	2010-07-04 19:35:05 +0000
@@ -34,7 +34,10 @@ end|
 reset master|
 --error ER_DUP_ENTRY
 insert into t2 values (bug23333(),1)| 
-# the following must show there is (are) events after the query */
+# the following must show there are events after the query
+# the binlog_limit is used to hide the differences between the mixed
+# and row logging formats after BUG#53259
+let $binlog_limit= 0, 4|
 source include/show_binlog_events.inc|
 select count(*),@a from t1 /* must be 1,1 */|
 

=== modified file 'mysys/CMakeLists.txt'
--- a/mysys/CMakeLists.txt	2010-06-06 11:19:29 +0000
+++ b/mysys/CMakeLists.txt	2010-07-08 21:20:08 +0000
@@ -29,10 +29,10 @@ SET(MYSYS_SOURCES  array.c charset-def.c
 				my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c
 				my_lib.c my_lock.c my_lockmem.c my_malloc.c my_mess.c
 				my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c 
-				my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_sleep.c
+				my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c
 				my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c 
 				my_write.c ptr_cmp.c queues.c stacktrace.c
-				rijndael.c safemalloc.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
+				rijndael.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
 				thr_rwlock.c tree.c typelib.c my_vle.c base64.c my_memmem.c my_getpagesize.c
 				lf_alloc-pin.c lf_dynarray.c lf_hash.c
 				my_atomic.c my_getncpus.c

=== modified file 'mysys/Makefile.am'
--- a/mysys/Makefile.am	2010-05-28 22:53:26 +0000
+++ b/mysys/Makefile.am	2010-07-08 21:20:08 +0000
@@ -29,9 +29,8 @@ libmysys_a_SOURCES =    my_init.c my_get
 			mf_keycaches.c my_crc32.c \
 			mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
 			mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \
-			my_malloc.c my_realloc.c my_once.c mulalloc.c \
-			my_alloc.c safemalloc.c my_new.cc \
-			my_vle.c my_atomic.c lf_hash.c \
+			my_malloc.c my_once.c mulalloc.c \
+			my_alloc.c my_new.cc my_vle.c my_atomic.c lf_hash.c \
 			lf_dynarray.c lf_alloc-pin.c \
 			my_fopen.c my_fstream.c my_getsystime.c \
 			my_error.c errors.c my_div.c my_mess.c \

=== modified file 'mysys/array.c'
--- a/mysys/array.c	2009-08-28 15:06:59 +0000
+++ b/mysys/array.c	2010-07-08 21:20:08 +0000
@@ -42,7 +42,7 @@
 
 my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
                             void *init_buffer, uint init_alloc, 
-                            uint alloc_increment CALLER_INFO_PROTO)
+                            uint alloc_increment)
 {
   DBUG_ENTER("init_dynamic_array");
   if (!alloc_increment)
@@ -67,14 +67,13 @@ my_bool init_dynamic_array2(DYNAMIC_ARRA
     Since the dynamic array is usable even if allocation fails here malloc
     should not throw an error
   */
-  if (!(array->buffer= (uchar*) my_malloc_ci(element_size*init_alloc, MYF(0))))
+  if (!(array->buffer= (uchar*) my_malloc(element_size*init_alloc, MYF(0))))
     array->max_element=0;
   DBUG_RETURN(FALSE);
 } 
 
 my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
-                           uint init_alloc, 
-                           uint alloc_increment CALLER_INFO_PROTO)
+                           uint init_alloc, uint alloc_increment)
 {
   /* placeholder to preserve ABI */
   return my_init_dynamic_array_ci(array, element_size, init_alloc, 
@@ -306,7 +305,7 @@ void delete_dynamic(DYNAMIC_ARRAY *array
   else
   if (array->buffer)
   {
-    my_free(array->buffer,MYF(MY_WME));
+    my_free(array->buffer);
     array->buffer=0;
     array->elements=array->max_element=0;
   }

=== modified file 'mysys/charset.c'
--- a/mysys/charset.c	2010-03-24 15:03:44 +0000
+++ b/mysys/charset.c	2010-07-08 21:20:08 +0000
@@ -383,11 +383,11 @@ static my_bool my_read_charset_file(cons
 #endif
   }
   
-  my_free(buf, myflags);
+  my_free(buf);
   return FALSE;
 
 error:
-  my_free(buf, myflags);
+  my_free(buf);
   return TRUE;
 }
 

=== modified file 'mysys/default_modify.c'
--- a/mysys/default_modify.c	2009-09-11 20:26:35 +0000
+++ b/mysys/default_modify.c	2010-07-08 21:20:08 +0000
@@ -223,11 +223,11 @@ int modify_defaults_file(const char *fil
   if (my_fclose(cnf_file, MYF(MY_WME)))
     DBUG_RETURN(1);
 
-  my_free(file_buffer, MYF(0));
+  my_free(file_buffer);
   DBUG_RETURN(0);
 
 err:
-  my_free(file_buffer, MYF(0));
+  my_free(file_buffer);
 malloc_err:
   my_fclose(cnf_file, MYF(0));
   DBUG_RETURN(1); /* out of resources */

=== modified file 'mysys/hash.c'
--- a/mysys/hash.c	2010-02-02 13:58:15 +0000
+++ b/mysys/hash.c	2010-07-08 21:20:08 +0000
@@ -67,8 +67,6 @@ static my_hash_value_type calc_hash(cons
   @param[in]     get_key      get the key for the hash
   @param[in]     free_element pointer to the function that
                               does cleanup
-  @param[in]     CALLER_INFO_PROTO flag that define the behaviour 
-                                   of the hash
   @return        inidicates success or failure of initialization
     @retval 0 success
     @retval 1 failure
@@ -77,7 +75,7 @@ my_bool
 _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
               ulong size, size_t key_offset, size_t key_length,
               my_hash_get_key get_key,
-              void (*free_element)(void*), uint flags CALLER_INFO_PROTO)
+              void (*free_element)(void*), uint flags)
 {
   DBUG_ENTER("my_hash_init");
   DBUG_PRINT("enter",("hash: 0x%lx  size: %u", (long) hash, (uint) size));

=== modified file 'mysys/lf_alloc-pin.c'
--- a/mysys/lf_alloc-pin.c	2010-05-26 14:12:23 +0000
+++ b/mysys/lf_alloc-pin.c	2010-07-08 21:20:08 +0000
@@ -472,7 +472,7 @@ void lf_alloc_destroy(LF_ALLOCATOR *allo
     uchar *tmp= anext_node(node);
     if (allocator->destructor)
       allocator->destructor(node);
-    my_free((void *)node, MYF(0));
+    my_free(node);
     node= tmp;
   }
   lf_pinbox_destroy(&allocator->pinbox);

=== modified file 'mysys/lf_dynarray.c'
--- a/mysys/lf_dynarray.c	2009-11-18 02:31:40 +0000
+++ b/mysys/lf_dynarray.c	2010-07-08 21:20:08 +0000
@@ -57,10 +57,10 @@ static void recursive_free(void **alloc,
     int i;
     for (i= 0; i < LF_DYNARRAY_LEVEL_LENGTH; i++)
       recursive_free(alloc[i], level-1);
-    my_free((void *)alloc, MYF(0));
+    my_free(alloc);
   }
   else
-    my_free(alloc[-1], MYF(0));
+    my_free(alloc[-1]);
 }
 
 void lf_dynarray_destroy(LF_DYNARRAY *array)
@@ -115,7 +115,7 @@ void *_lf_dynarray_lvalue(LF_DYNARRAY *a
       if (my_atomic_casptr(ptr_ptr, &ptr, alloc))
         ptr= alloc;
       else
-        my_free(alloc, MYF(0));
+        my_free(alloc);
     }
     ptr_ptr= ((void **)ptr) + idx / dynarray_idxes_in_prev_level[i];
     idx%= dynarray_idxes_in_prev_level[i];
@@ -139,7 +139,7 @@ void *_lf_dynarray_lvalue(LF_DYNARRAY *a
     if (my_atomic_casptr(ptr_ptr, &ptr, data))
       ptr= data;
     else
-      my_free(alloc, MYF(0));
+      my_free(alloc);
   }
   return ((uchar*)ptr) + array->size_of_element * idx;
 }

=== modified file 'mysys/lf_hash.c'
--- a/mysys/lf_hash.c	2009-11-18 02:31:40 +0000
+++ b/mysys/lf_hash.c	2010-07-08 21:20:08 +0000
@@ -344,7 +344,7 @@ void lf_hash_destroy(LF_HASH *hash)
     if (el->hashnr & 1)
       lf_alloc_direct_free(&hash->alloc, el); /* normal node */
     else
-      my_free((void *)el, MYF(0)); /* dummy node */
+      my_free(el); /* dummy node */
     el= (LF_SLIST *)next;
   }
   lf_alloc_destroy(&hash->alloc);
@@ -489,7 +489,7 @@ static int initialize_bucket(LF_HASH *ha
   dummy->keylen= 0;
   if ((cur= linsert(el, hash->charset, dummy, pins, LF_HASH_UNIQUE)))
   {
-    my_free((void *)dummy, MYF(0));
+    my_free(dummy);
     dummy= cur;
   }
   my_atomic_casptr((void **)node, (void **)&tmp, dummy);

=== modified file 'mysys/list.c'
--- a/mysys/list.c	2007-05-10 09:59:39 +0000
+++ b/mysys/list.c	2010-07-08 21:20:08 +0000
@@ -61,8 +61,8 @@ void list_free(LIST *root, uint free_dat
   {
     next=root->next;
     if (free_data)
-      my_free((uchar*) root->data,MYF(0));
-    my_free((uchar*) root,MYF(0));
+      my_free(root->data);
+    my_free(root);
     root=next;
   }
 }

=== modified file 'mysys/mf_cache.c'
--- a/mysys/mf_cache.c	2007-05-10 09:59:39 +0000
+++ b/mysys/mf_cache.c	2010-07-08 21:20:08 +0000
@@ -71,8 +71,8 @@ my_bool open_cached_file(IO_CACHE *cache
   {
     DBUG_RETURN(0);
   }
-  my_free(cache->dir,	MYF(MY_ALLOW_ZERO_PTR));
-  my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(cache->dir);
+  my_free(cache->prefix);
   DBUG_RETURN(1);
 }
 
@@ -110,12 +110,12 @@ void close_cached_file(IO_CACHE *cache)
       if (cache->file_name)
       {
 	(void) my_delete(cache->file_name,MYF(MY_WME | ME_NOINPUT));
-	my_free(cache->file_name,MYF(0));
+	my_free(cache->file_name);
       }
 #endif
     }
-    my_free(cache->dir,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(cache->prefix,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(cache->dir);
+    my_free(cache->prefix);
   }
   DBUG_VOID_RETURN;
 }

=== modified file 'mysys/mf_iocache.c'
--- a/mysys/mf_iocache.c	2010-06-29 14:28:36 +0000
+++ b/mysys/mf_iocache.c	2010-07-13 08:39:24 +0000
@@ -1875,7 +1875,7 @@ int end_io_cache(IO_CACHE *info)
     info->alloced_buffer=0;
     if (info->file != -1)			/* File doesn't exist */
       error= my_b_flush_io_cache(info,1);
-    my_free((uchar*) info->buffer,MYF(MY_WME));
+    my_free(info->buffer);
     info->buffer=info->read_pos=(uchar*) 0;
   }
   if (info->type == SEQ_READ_APPEND)
@@ -1961,7 +1961,7 @@ int main(int argc, char** argv)
     total_bytes += 4+block_size;
   }
   close_file(&sra_cache);
-  my_free(block,MYF(MY_WME));
+  my_free(block);
   if (!my_stat(fname,&status,MYF(MY_WME)))
     die("%s failed to stat, but I had just closed it,\
  wonder how that happened");

=== modified file 'mysys/mf_keycache.c'
--- a/mysys/mf_keycache.c	2009-12-10 03:19:51 +0000
+++ b/mysys/mf_keycache.c	2010-07-08 21:20:08 +0000
@@ -446,7 +446,7 @@ int init_key_cache(KEY_CACHE *keycache, 
         if ((keycache->block_root= (BLOCK_LINK*) my_malloc(length,
                                                            MYF(0))))
           break;
-        my_large_free(keycache->block_mem, MYF(0));
+        my_large_free(keycache->block_mem);
         keycache->block_mem= 0;
       }
       if (blocks < 8)
@@ -521,12 +521,12 @@ err:
   keycache->blocks=  0;
   if (keycache->block_mem)
   {
-    my_large_free((uchar*) keycache->block_mem, MYF(0));
+    my_large_free((uchar*) keycache->block_mem);
     keycache->block_mem= NULL;
   }
   if (keycache->block_root)
   {
-    my_free((uchar*) keycache->block_root, MYF(0));
+    my_free(keycache->block_root);
     keycache->block_root= NULL;
   }
   my_errno= error;
@@ -747,9 +747,9 @@ void end_key_cache(KEY_CACHE *keycache, 
   {
     if (keycache->block_mem)
     {
-      my_large_free((uchar*) keycache->block_mem, MYF(0));
+      my_large_free((uchar*) keycache->block_mem);
       keycache->block_mem= NULL;
-      my_free((uchar*) keycache->block_root, MYF(0));
+      my_free(keycache->block_root);
       keycache->block_root= NULL;
     }
     keycache->disk_blocks= -1;
@@ -4080,7 +4080,7 @@ restart:
 #endif
 err:
   if (cache != cache_buff)
-    my_free((uchar*) cache, MYF(0));
+    my_free(cache);
   if (last_errno)
     errno=last_errno;                /* Return first error */
   DBUG_RETURN(last_errno != 0);

=== modified file 'mysys/mf_keycaches.c'
--- a/mysys/mf_keycaches.c	2009-10-14 16:37:38 +0000
+++ b/mysys/mf_keycaches.c	2010-07-08 21:20:08 +0000
@@ -71,7 +71,7 @@ typedef struct st_safe_hash_with_default
 static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
 {
   DBUG_ENTER("free_assign_entry");
-  my_free((uchar*) entry, MYF(0));
+  my_free(entry);
   DBUG_VOID_RETURN;
 }
 
@@ -234,7 +234,7 @@ static my_bool safe_hash_set(SAFE_HASH *
     if (my_hash_insert(&hash->hash, (uchar*) entry))
     {
       /* This can only happen if hash got out of memory */
-      my_free((char*) entry, MYF(0));
+      my_free(entry);
       error= 1;
       goto end;
     }

=== modified file 'mysys/mf_sort.c'
--- a/mysys/mf_sort.c	2007-10-18 10:32:43 +0000
+++ b/mysys/mf_sort.c	2010-07-08 21:20:08 +0000
@@ -27,7 +27,7 @@ void my_string_ptr_sort(uchar *base, uin
       (ptr= (uchar**) my_malloc(items*sizeof(char*),MYF(0))))
   {
     radixsort_for_str_ptr((uchar**) base,items,size,ptr);
-    my_free((uchar*) ptr,MYF(0));
+    my_free(ptr);
   }
   else
 #endif

=== modified file 'mysys/mf_tempdir.c'
--- a/mysys/mf_tempdir.c	2009-12-10 03:19:51 +0000
+++ b/mysys/mf_tempdir.c	2010-07-08 21:20:08 +0000
@@ -88,7 +88,7 @@ void free_tmpdir(MY_TMPDIR *tmpdir)
   if (!tmpdir->full_list.elements)
     return;
   for (i=0; i<=tmpdir->max; i++)
-    my_free(tmpdir->list[i], MYF(0));
+    my_free(tmpdir->list[i]);
   delete_dynamic(&tmpdir->full_list);
   mysql_mutex_destroy(&tmpdir->mutex);
 }

=== modified file 'mysys/mf_wfile.c'
--- a/mysys/mf_wfile.c	2010-06-10 20:16:43 +0000
+++ b/mysys/mf_wfile.c	2010-07-08 21:20:08 +0000
@@ -118,7 +118,6 @@ found:
 void wf_end(WF_PACK *buffer)
 {
   DBUG_ENTER("wf_end");
-  if (buffer)
-    my_free(buffer, MYF(0));
+  my_free(buffer);
   DBUG_VOID_RETURN;
 } /* wf_end */

=== modified file 'mysys/my_alloc.c'
--- a/mysys/my_alloc.c	2010-06-11 13:48:24 +0000
+++ b/mysys/my_alloc.c	2010-07-08 21:20:08 +0000
@@ -120,7 +120,7 @@ void reset_root_defaults(MEM_ROOT *mem_r
         {
           /* remove block from the list and free it */
           *prev= mem->next;
-          my_free(mem, MYF(0));
+          my_free(mem);
         }
         else
           prev= &mem->next;
@@ -362,13 +362,13 @@ void free_root(MEM_ROOT *root, myf MyFla
   {
     old=next; next= next->next ;
     if (old != root->pre_alloc)
-      my_free(old,MYF(0));
+      my_free(old);
   }
   for (next=root->free ; next ;)
   {
     old=next; next= next->next;
     if (old != root->pre_alloc)
-      my_free(old,MYF(0));
+      my_free(old);
   }
   root->used=root->free=0;
   if (root->pre_alloc)

=== modified file 'mysys/my_bitmap.c'
--- a/mysys/my_bitmap.c	2009-12-10 03:19:51 +0000
+++ b/mysys/my_bitmap.c	2010-07-08 21:20:08 +0000
@@ -150,7 +150,7 @@ void bitmap_free(MY_BITMAP *map)
     if (map->mutex)
       mysql_mutex_destroy(map->mutex);
 #endif
-    my_free((char*) map->bitmap, MYF(0));
+    my_free(map->bitmap);
     map->bitmap=0;
   }
   DBUG_VOID_RETURN;

=== modified file 'mysys/my_compress.c'
--- a/mysys/my_compress.c	2009-02-13 16:41:47 +0000
+++ b/mysys/my_compress.c	2010-07-08 21:20:08 +0000
@@ -51,7 +51,7 @@ my_bool my_compress(uchar *packet, size_
     if (!compbuf)
       DBUG_RETURN(*complen ? 0 : 1);
     memcpy(packet,compbuf,*len);
-    my_free(compbuf,MYF(MY_WME));
+    my_free(compbuf);
   }
   DBUG_RETURN(0);
 }
@@ -73,14 +73,14 @@ uchar *my_compress_alloc(const uchar *pa
 
   if (res != Z_OK)
   {
-    my_free(compbuf, MYF(MY_WME));
+    my_free(compbuf);
     return 0;
   }
 
   if (*complen >= *len)
   {
     *complen= 0;
-    my_free(compbuf, MYF(MY_WME));
+    my_free(compbuf);
     DBUG_PRINT("note",("Packet got longer on compression; Not compressed"));
     return 0;
   }
@@ -125,11 +125,11 @@ my_bool my_uncompress(uchar *packet, siz
     if (error != Z_OK)
     {						/* Probably wrong packet */
       DBUG_PRINT("error",("Can't uncompress packet, error: %d",error));
-      my_free(compbuf, MYF(MY_WME));
+      my_free(compbuf);
       DBUG_RETURN(1);
     }
     memcpy(packet, compbuf, *complen);
-    my_free(compbuf, MYF(MY_WME));
+    my_free(compbuf);
   }
   else
     *complen= len;
@@ -250,7 +250,7 @@ int unpackfrm(uchar **unpack_data, size_
 
    if (my_uncompress(data, complen, &orglen))
    {
-     my_free(data, MYF(0));
+     my_free(data);
      DBUG_RETURN(3);
    }
 

=== modified file 'mysys/my_error.c'
--- a/mysys/my_error.c	2009-11-02 20:05:42 +0000
+++ b/mysys/my_error.c	2010-07-08 21:20:08 +0000
@@ -211,7 +211,7 @@ int my_error_register(const char** (*get
   /* Error numbers must be unique. No overlapping is allowed. */
   if (*search_meh_pp && ((*search_meh_pp)->meh_first <= last))
   {
-    my_free((uchar*)meh_p, MYF(0));
+    my_free(meh_p);
     return 1;
   }
 
@@ -267,7 +267,7 @@ const char **my_error_unregister(int fir
 
   /* Save the return value and free the header. */
   errmsgs= meh_p->get_errmsgs();
-  my_free((uchar*) meh_p, MYF(0));
+  my_free(meh_p);
   
   return errmsgs;
 }
@@ -282,7 +282,7 @@ void my_error_unregister_all(void)
     /* We need this ptr, but we're about to free its container, so save it. */
     saved_next= cursor->meh_next;
 
-    my_free((uchar*) cursor, MYF(0));
+    my_free(cursor);
   }
   my_errmsgs_globerrs.meh_next= NULL;  /* Freed in first iteration above. */
 

=== modified file 'mysys/my_file.c'
--- a/mysys/my_file.c	2010-04-11 07:17:42 +0000
+++ b/mysys/my_file.c	2010-07-08 21:20:08 +0000
@@ -127,7 +127,7 @@ void my_free_open_file_info()
     /* Copy data back for my_print_open_files */
     memcpy((char*) my_file_info_default, my_file_info,
            sizeof(*my_file_info_default)* MY_NFILE);
-    my_free((char*) my_file_info, MYF(0));
+    my_free(my_file_info);
     my_file_info= my_file_info_default;
     my_file_limit= MY_NFILE;
   }

=== modified file 'mysys/my_fopen.c'
--- a/mysys/my_fopen.c	2009-12-10 03:19:51 +0000
+++ b/mysys/my_fopen.c	2010-07-08 21:20:08 +0000
@@ -117,7 +117,7 @@ int my_fclose(FILE *fd, myf MyFlags)
   if ((uint) file < my_file_limit && my_file_info[file].type != UNOPEN)
   {
     my_file_info[file].type = UNOPEN;
-    my_free(my_file_info[file].name, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(my_file_info[file].name);
   }
   mysql_mutex_unlock(&THR_LOCK_open);
   DBUG_RETURN(err);

=== modified file 'mysys/my_gethwaddr.c'
--- a/mysys/my_gethwaddr.c	2010-05-31 15:29:54 +0000
+++ b/mysys/my_gethwaddr.c	2010-07-08 21:20:08 +0000
@@ -196,7 +196,7 @@ my_bool my_gethwaddr(uchar *to)
 
   /* Clean up memory allocation. */
   if (pAdapterAddresses != &adapterAddresses)
-    my_free(pAdapterAddresses, 0);
+    my_free(pAdapterAddresses);
 
   return return_val;
 }

=== modified file 'mysys/my_getopt.c'
--- a/mysys/my_getopt.c	2010-06-11 01:30:49 +0000
+++ b/mysys/my_getopt.c	2010-07-08 21:20:08 +0000
@@ -596,8 +596,7 @@ static int setval(const struct my_option
     case GET_STR_ALLOC:
       if (argument == enabled_my_option)
         break; /* string options don't use this default of "1" */
-      if ((*((char**) value)))
-	my_free((*(char**) value), MYF(MY_WME | MY_FAE));
+      my_free(*((char**) value));
       if (!(*((char**) value)= my_strdup(argument, MYF(MY_WME))))
       {
         res= EXIT_OUT_OF_MEMORY;
@@ -1054,8 +1053,9 @@ static void init_one_value(const struct 
     */
     if ((char*) (intptr) value)
     {
-      my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR));
-      *((char**) variable)= my_strdup((char*) (intptr) value, MYF(MY_WME));
+      char **pstr= (char **) variable;
+      my_free(*pstr);
+      *pstr= my_strdup((char*) (intptr) value, MYF(MY_WME));
     }
     break;
   default: /* dummy default to avoid compiler warnings */
@@ -1080,7 +1080,7 @@ static void fini_one_value(const struct 
   DBUG_ENTER("fini_one_value");
   switch ((option->var_type & GET_TYPE_MASK)) {
   case GET_STR_ALLOC:
-    my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR));
+    my_free(*((char**) variable));
     *((char**) variable)= NULL;
     break;
   default: /* dummy default to avoid compiler warnings */

=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2010-06-18 15:04:15 +0000
+++ b/mysys/my_init.c	2010-07-08 21:20:08 +0000
@@ -141,6 +141,7 @@ my_bool my_init(void)
 {
   if (my_init_done)
     return 0;
+
   my_init_done= 1;
 
   if (my_basic_init())
@@ -241,9 +242,7 @@ Voluntary context switches %ld, Involunt
 #if defined(__NETWARE__) && !defined(__WIN__)
     fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
 #endif
-#if defined(SAFEMALLOC)
-    TERMINATE(stderr, (infoflag & MY_GIVE_INFO) != 0);
-#elif defined(__WIN__) && defined(_MSC_VER)
+#if defined(__WIN__) && defined(_MSC_VER)
    _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );
    _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
@@ -254,10 +253,6 @@ Voluntary context switches %ld, Involunt
    _CrtDumpMemoryLeaks();
 #endif
   }
-  else if (infoflag & MY_CHECK_ERROR)
-  {
-    TERMINATE(stderr, 0);		/* Print memory leaks on screen */
-  }
 
   if (!(infoflag & MY_DONT_FREE_DBUG))
   {
@@ -280,6 +275,7 @@ Voluntary context switches %ld, Involunt
   if (have_tcpip)
     WSACleanup();
 #endif /* __WIN__ */
+
   my_init_done=0;
   my_basic_init_done= 0;
 } /* my_end */

=== modified file 'mysys/my_largepage.c'
--- a/mysys/my_largepage.c	2009-12-10 03:19:51 +0000
+++ b/mysys/my_largepage.c	2010-07-08 21:20:08 +0000
@@ -27,7 +27,7 @@
 
 static uint my_get_large_page_size_int(void);
 static uchar* my_large_malloc_int(size_t size, myf my_flags);
-static my_bool my_large_free_int(uchar* ptr, myf my_flags);
+static my_bool my_large_free_int(uchar* ptr);
 
 /* Gets the size of large pages from the OS */
 
@@ -70,7 +70,7 @@ uchar* my_large_malloc(size_t size, myf 
   to my_free_lock() in case of failure
  */
 
-void my_large_free(uchar* ptr, myf my_flags __attribute__((unused)))
+void my_large_free(uchar* ptr)
 {
   DBUG_ENTER("my_large_free");
   
@@ -79,9 +79,8 @@ void my_large_free(uchar* ptr, myf my_fl
     my_large_malloc_int(), i.e. my_malloc_lock() was used so we should free it
     with my_free_lock()
   */
-  if (!my_use_large_pages || !my_large_page_size ||
-      !my_large_free_int(ptr, my_flags))
-    my_free_lock(ptr, my_flags);
+  if (!my_use_large_pages || !my_large_page_size || !my_large_free_int(ptr))
+    my_free_lock(ptr);
 
   DBUG_VOID_RETURN;
 }
@@ -157,7 +156,7 @@ uchar* my_large_malloc_int(size_t size, 
 
 /* Linux-specific large pages deallocator */
 
-my_bool my_large_free_int(uchar *ptr, myf my_flags __attribute__((unused)))
+my_bool my_large_free_int(uchar *ptr)
 {
   DBUG_ENTER("my_large_free_int");
   DBUG_RETURN(shmdt(ptr) == 0);

=== modified file 'mysys/my_lib.c'
--- a/mysys/my_lib.c	2009-12-10 03:19:51 +0000
+++ b/mysys/my_lib.c	2010-07-08 21:20:08 +0000
@@ -77,7 +77,7 @@ void my_dirend(MY_DIR *buffer)
                                     ALIGN_SIZE(sizeof(MY_DIR))));
     free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) + 
                           ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))), MYF(0));
-    my_free((uchar*) buffer,MYF(0));
+    my_free(buffer);
   }
   DBUG_VOID_RETURN;
 } /* my_dirend */
@@ -131,7 +131,7 @@ MY_DIR	*my_dir(const char *path, myf MyF
   if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
                             ENTRIES_START_SIZE, ENTRIES_INCREMENT))
   {
-    my_free((uchar*) buffer,MYF(0));
+    my_free(buffer);
     goto error;
   }
   init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
@@ -400,7 +400,7 @@ MY_DIR	*my_dir(const char *path, myf MyF
   if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
                             ENTRIES_START_SIZE, ENTRIES_INCREMENT))
   {
-    my_free((uchar*) buffer,MYF(0));
+    my_free(buffer);
     goto error;
   }
   init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE);
@@ -547,7 +547,7 @@ MY_STAT *my_stat(const char *path, MY_ST
   DBUG_PRINT("error",("Got errno: %d from stat", errno));
   my_errno= errno;
   if (m_used)					/* Free if new area */
-    my_free((uchar*) stat_area,MYF(0));
+    my_free(stat_area);
 
 error:
   if (my_flags & (MY_FAE+MY_WME))

=== modified file 'mysys/my_lockmem.c'
--- a/mysys/my_lockmem.c	2009-12-10 03:19:51 +0000
+++ b/mysys/my_lockmem.c	2010-07-08 21:20:08 +0000
@@ -74,7 +74,7 @@ uchar *my_malloc_lock(uint size,myf MyFl
 }
 
 
-void my_free_lock(uchar *ptr,myf Myflags __attribute__((unused)))
+void my_free_lock(uchar *ptr)
 {
   LIST *list;
   struct st_mem_list *element=0;
@@ -91,8 +91,7 @@ void my_free_lock(uchar *ptr,myf Myflags
     }
   }
   mysql_mutex_unlock(&THR_LOCK_malloc);
-  if (element)
-    my_free((uchar*) element,MYF(0));
+  my_free(element);
   free(ptr);					/* Free even if not locked */
 }
 

=== modified file 'mysys/my_malloc.c'
--- a/mysys/my_malloc.c	2010-05-21 11:23:48 +0000
+++ b/mysys/my_malloc.c	2010-07-08 21:20:08 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -11,28 +11,31 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#ifdef SAFEMALLOC			/* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
 #include "mysys_priv.h"
 #include "mysys_err.h"
 #include <m_string.h>
 
-	/* My memory allocator */
+/**
+  Allocate a sized block of memory.
 
+  @param size   The size of the memory block in bytes.
+  @param flags  Failure action modifiers (bitmasks).
+
+  @return A pointer to the allocated memory block, or NULL on failure.
+*/
 void *my_malloc(size_t size, myf my_flags)
 {
   void* point;
   DBUG_ENTER("my_malloc");
   DBUG_PRINT("my",("size: %lu  my_flags: %d", (ulong) size, my_flags));
 
+  /* Safety */
   if (!size)
-    size=1;					/* Safety */
+    size=1;
 
-  point= (char *) malloc(size);
+  point= malloc(size);
   DBUG_EXECUTE_IF("simulate_out_of_memory",
                   {
                     free(point);
@@ -52,33 +55,87 @@ void *my_malloc(size_t size, myf my_flag
       exit(1);
   }
   else if (my_flags & MY_ZEROFILL)
-    bzero(point,size);
-  DBUG_PRINT("exit",("ptr: 0x%lx", (long) point));
-  DBUG_RETURN((void*) point);
-} /* my_malloc */
+    bzero(point, size);
+  DBUG_PRINT("exit",("ptr: %p", point));
+  DBUG_RETURN(point);
+}
 
 
-	/* Free memory allocated with my_malloc */
-	/*ARGSUSED*/
+/**
+   @brief wrapper around realloc()
 
-void my_no_flags_free(void* ptr)
+   @param  oldpoint        pointer to currently allocated area
+   @param  size            new size requested, must be >0
+   @param  my_flags        flags
+
+   @note if size==0 realloc() may return NULL; my_realloc() treats this as an
+   error which is not the intention of realloc()
+*/
+void *my_realloc(void *oldpoint, size_t size, myf my_flags)
+{
+  void *point;
+  DBUG_ENTER("my_realloc");
+  DBUG_PRINT("my",("ptr: %p  size: %lu  my_flags: %d", oldpoint,
+                   (ulong) size, my_flags));
+
+  DBUG_ASSERT(size > 0);
+  if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
+    DBUG_RETURN(my_malloc(size, my_flags));
+#ifdef USE_HALLOC
+  if (!(point = malloc(size)))
+  {
+    if (my_flags & MY_FREE_ON_ERROR)
+      my_free(oldpoint);
+    if (my_flags & MY_HOLD_ON_ERROR)
+      DBUG_RETURN(oldpoint);
+    my_errno=errno;
+    if (my_flags & MY_FAE+MY_WME)
+      my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
+  }
+  else
+  {
+    memcpy(point,oldpoint,size);
+    free(oldpoint);
+  }
+#else
+  if ((point= realloc(oldpoint, size)) == NULL)
+  {
+    if (my_flags & MY_FREE_ON_ERROR)
+      my_free(oldpoint);
+    if (my_flags & MY_HOLD_ON_ERROR)
+      DBUG_RETURN(oldpoint);
+    my_errno=errno;
+    if (my_flags & (MY_FAE+MY_WME))
+      my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size);
+  }
+#endif
+  DBUG_PRINT("exit",("ptr: %p", point));
+  DBUG_RETURN(point);
+}
+
+
+/**
+  Free memory allocated with my_malloc.
+
+  @remark Relies on free being able to handle a NULL argument.
+
+  @param ptr Pointer to the memory allocated by my_malloc.
+*/
+void my_free(void *ptr)
 {
   DBUG_ENTER("my_free");
-  DBUG_PRINT("my",("ptr: 0x%lx", (long) ptr));
-  if (ptr)
-    free(ptr);
+  DBUG_PRINT("my",("ptr: %p", ptr));
+  free(ptr);
   DBUG_VOID_RETURN;
-} /* my_free */
-
+}
 
-	/* malloc and copy */
 
-void* my_memdup(const void *from, size_t length, myf my_flags)
+void *my_memdup(const void *from, size_t length, myf my_flags)
 {
   void *ptr;
   if ((ptr= my_malloc(length,my_flags)) != 0)
     memcpy(ptr, from, length);
-  return(ptr);
+  return ptr;
 }
 
 
@@ -87,18 +144,19 @@ char *my_strdup(const char *from, myf my
   char *ptr;
   size_t length= strlen(from)+1;
   if ((ptr= (char*) my_malloc(length, my_flags)))
-    memcpy((uchar*) ptr, (uchar*) from,(size_t) length);
-  return(ptr);
+    memcpy(ptr, from, length);
+  return ptr;
 }
 
 
 char *my_strndup(const char *from, size_t length, myf my_flags)
 {
   char *ptr;
-  if ((ptr= (char*) my_malloc(length+1,my_flags)) != 0)
+  if ((ptr= (char*) my_malloc(length+1, my_flags)))
   {
-    memcpy((uchar*) ptr, (uchar*) from, length);
-    ptr[length]=0;
+    memcpy(ptr, from, length);
+    ptr[length]= 0;
   }
-  return((char*) ptr);
+  return ptr;
 }
+

=== modified file 'mysys/my_once.c'
--- a/mysys/my_once.c	2009-12-26 20:55:32 +0000
+++ b/mysys/my_once.c	2010-07-08 21:20:08 +0000
@@ -15,10 +15,6 @@
 
 /* Not MT-SAFE */
 
-#ifdef SAFEMALLOC			/* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
 #include "mysys_priv.h"
 #include "my_static.h"
 #include "mysys_err.h"

=== modified file 'mysys/my_open.c'
--- a/mysys/my_open.c	2009-12-10 03:19:51 +0000
+++ b/mysys/my_open.c	2010-07-08 21:20:08 +0000
@@ -88,7 +88,7 @@ int my_close(File fd, myf MyFlags)
   }
   if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN)
   {
-    my_free(my_file_info[fd].name, MYF(0));
+    my_free(my_file_info[fd].name);
 #if defined(THREAD) && !defined(HAVE_PREAD) && !defined(_WIN32)
     mysql_mutex_destroy(&my_file_info[fd].mutex);
 #endif

=== removed file 'mysys/my_realloc.c'
--- a/mysys/my_realloc.c	2007-10-11 15:07:40 +0000
+++ b/mysys/my_realloc.c	1970-01-01 00:00:00 +0000
@@ -1,75 +0,0 @@
-/* Copyright (C) 2000 MySQL AB
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-#ifdef SAFEMALLOC			/* We don't need SAFEMALLOC here */
-#undef SAFEMALLOC
-#endif
-
-#include "mysys_priv.h"
-#include "mysys_err.h"
-
-	/* My memory re allocator */
-
-/**
-   @brief wrapper around realloc()
-
-   @param  oldpoint        pointer to currently allocated area
-   @param  size            new size requested, must be >0
-   @param  my_flags        flags
-
-   @note if size==0 realloc() may return NULL; my_realloc() treats this as an
-   error which is not the intention of realloc()
-*/
-void* my_realloc(void* oldpoint, size_t size, myf my_flags)
-{
-  void *point;
-  DBUG_ENTER("my_realloc");
-  DBUG_PRINT("my",("ptr: 0x%lx  size: %lu  my_flags: %d", (long) oldpoint,
-                   (ulong) size, my_flags));
-
-  DBUG_ASSERT(size > 0);
-  if (!oldpoint && (my_flags & MY_ALLOW_ZERO_PTR))
-    DBUG_RETURN(my_malloc(size,my_flags));
-#ifdef USE_HALLOC
-  if (!(point = malloc(size)))
-  {
-    if (my_flags & MY_FREE_ON_ERROR)
-      my_free(oldpoint,my_flags);
-    if (my_flags & MY_HOLD_ON_ERROR)
-      DBUG_RETURN(oldpoint);
-    my_errno=errno;
-    if (my_flags & MY_FAE+MY_WME)
-      my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
-  }
-  else
-  {
-    memcpy(point,oldpoint,size);
-    free(oldpoint);
-  }
-#else
-  if ((point= (uchar*) realloc(oldpoint,size)) == NULL)
-  {
-    if (my_flags & MY_FREE_ON_ERROR)
-      my_free(oldpoint, my_flags);
-    if (my_flags & MY_HOLD_ON_ERROR)
-      DBUG_RETURN(oldpoint);
-    my_errno=errno;
-    if (my_flags & (MY_FAE+MY_WME))
-      my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size);
-  }
-#endif
-  DBUG_PRINT("exit",("ptr: 0x%lx", (long) point));
-  DBUG_RETURN(point);
-} /* my_realloc */

=== modified file 'mysys/my_windac.c'
--- a/mysys/my_windac.c	2007-05-10 09:59:39 +0000
+++ b/mysys/my_windac.c	2010-07-08 21:20:08 +0000
@@ -194,8 +194,8 @@ error:
     FreeSid(everyone_sid);
   if (htoken)
     CloseHandle(htoken);
-  my_free((uchar*) sa, MYF(MY_ALLOW_ZERO_PTR));
-  my_free((uchar*) dacl, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(sa);
+  my_free(dacl);
   *psa= 0;
   return 1;
 }
@@ -215,8 +215,8 @@ void my_security_attr_free(SECURITY_ATTR
     My_security_attr *attr= (My_security_attr*)
                             (((char*)sa) + ALIGN_SIZE(sizeof(*sa)));
     FreeSid(attr->everyone_sid);
-    my_free((uchar*) attr->dacl, MYF(0));
-    my_free((uchar*) sa, MYF(0));
+    my_free(attr->dacl);
+    my_free(sa);
   }
 }
 

=== modified file 'mysys/queues.c'
--- a/mysys/queues.c	2008-02-18 22:29:39 +0000
+++ b/mysys/queues.c	2010-07-08 21:20:08 +0000
@@ -194,11 +194,8 @@ int resize_queue(QUEUE *queue, uint max_
 void delete_queue(QUEUE *queue)
 {
   DBUG_ENTER("delete_queue");
-  if (queue->root)
-  {
-    my_free((uchar*) queue->root,MYF(0));
-    queue->root=0;
-  }
+  my_free(queue->root);
+  queue->root= NULL;
   DBUG_VOID_RETURN;
 }
 

=== removed file 'mysys/safemalloc.c'
--- a/mysys/safemalloc.c	2010-06-11 13:54:39 +0000
+++ b/mysys/safemalloc.c	1970-01-01 00:00:00 +0000
@@ -1,576 +0,0 @@
-/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
-
-/*
- * Memory sub-system, written by Bjorn Benson
-   Fixed to use my_sys scheme by Michael Widenius
-
-  [This posting refers to an article entitled "oops, corrupted memory
-  again!" in net.lang.c.  I am posting it here because it is source.]
-
-  My tool for approaching this problem is to build another level of data
-  abstraction on top of malloc() and free() that implements some checking.
-  This does a number of things for you:
-	- Checks for overruns and underruns on allocated data
-	- Keeps track of where in the program the memory was malloc'ed
-	- Reports on pieces of memory that were not free'ed
-	- Records some statistics such as maximum memory used
-	- Marks newly malloc'ed and newly free'ed memory with special values
-  You can use this scheme to:
-	- Find bugs such as overrun, underrun, etc because you know where
-	  a piece of data was malloc'ed and where it was free'ed
-	- Find bugs where memory was not free'ed
-	- Find bugs where newly malloc'ed memory is used without initializing
-	- Find bugs where newly free'ed memory is still used
-	- Determine how much memory your program really uses
-	- and other things
-
-  To implement my scheme you must have a C compiler that has __LINE__ and
-  __FILE__ macros.  If your compiler doesn't have these then (a) buy another:
-  compilers that do are available on UNIX 4.2bsd based systems and the PC,
-  and probably on other machines; or (b) change my scheme somehow.  I have
-  recomendations on both these points if you would like them (e-mail please).
-
-  There are 4 functions in my package:
-	char *NEW( uSize )	Allocate memory of uSize bytes
-				(equivalent to malloc())
-	char *REA( pPtr, uSize) Allocate memory of uSize bytes, move data and
-				free pPtr.
-				(equivalent to realloc())
-	FREE( pPtr )		Free memory allocated by NEW
-				(equivalent to free())
-	TERMINATE(file,flag)	End system, report errors and stats on file
-  I personally use two more functions, but have not included them here:
-	char *STRSAVE( sPtr )	Save a copy of the string in dynamic memory
-	char *RENEW( pPtr, uSize )
-				(equivalent to realloc())
-
-*/
-
-#ifndef SAFEMALLOC
-#define SAFEMALLOC			/* Get protos from my_sys */
-#endif
-
-#include "mysys_priv.h"
-#include <m_string.h>
-#include "my_static.h"
-#include "mysys_err.h"
-
-ulonglong sf_malloc_mem_limit= ~(ulonglong)0;
-
-#ifndef PEDANTIC_SAFEMALLOC
-/*
-  Set to 1 after TERMINATE() if we had to fiddle with sf_malloc_count and
-  the linked list of blocks so that _sanity() will not fuss when it
-  is not supposed to
-*/
-static int sf_malloc_tampered= 0;
-#endif
-				   
-
-	/* Static functions prototypes */
-
-static int check_ptr(const char *where, uchar *ptr, const char *sFile,
-		     uint uLine);
-static int _checkchunk(struct st_irem *pRec, const char *sFile, uint uLine);
-
-/*
-  Note: We only fill up the allocated block. This do not include
-  malloc() roundoff or the extra space required by the irem
-  structures.
-*/
-
-/*
-  NEW'ed memory is filled with this value so that references to it will
-  end up being very strange.
-*/
-#define ALLOC_VAL	(uchar) 0xA5
-/*
-  FEEE'ed memory is filled with this value so that references to it will
-  end up being very strange.
-*/
-#define FREE_VAL	(uchar) 0x8F
-#define MAGICKEY	0x14235296	/* A magic value for underrun key */
-
-/*
-  Warning: do not change the MAGICEND? values to something with the
-  high bit set.  Various C compilers (like the 4.2bsd one) do not do
-  the sign extension right later on in this code and you will get
-  erroneous errors.
-*/
-
-#define MAGICEND0	0x68		/* Magic values for overrun keys  */
-#define MAGICEND1	0x34		/*		"		  */
-#define MAGICEND2	0x7A		/*		"		  */
-#define MAGICEND3	0x15		/*		"		  */
-
-
-/* Allocate some memory. */
-
-void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
-{
-  struct st_irem *irem;
-  uchar *data;
-  DBUG_ENTER("_mymalloc");
-  DBUG_PRINT("enter",("Size: %lu", (ulong) size));
-
-  if (!sf_malloc_quick)
-    (void) _sanity (filename, lineno);
-
-  if (size + sf_malloc_cur_memory > sf_malloc_mem_limit)
-    irem= 0;
-  else
-  {
-    /* Allocate the physical memory */
-    irem= (struct st_irem *) malloc (ALIGN_SIZE(sizeof(struct st_irem)) +
-				     sf_malloc_prehunc +
-				     size +	/* size requested */
-				     4 +	/* overrun mark */
-				     sf_malloc_endhunc);
-    DBUG_EXECUTE_IF("simulate_out_of_memory",
-                    {
-                      free(irem);
-                      irem= NULL;
-                    });
-  }
-  /* Check if there isn't anymore memory avaiable */
-  if (!irem)
-  {
-    if (MyFlags & MY_FAE)
-      error_handler_hook=fatal_error_handler_hook;
-    if (MyFlags & (MY_FAE+MY_WME))
-    {
-      char buff[256];
-      my_errno=errno;
-      sprintf(buff,"Out of memory at line %d, '%s'", lineno, filename);
-      my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
-      sprintf(buff,"needed %lu byte (%luk), memory in use: %lu bytes (%luk)",
-	      (ulong) size, (ulong) (size + 1023L) / 1024L,
-	      (ulong) sf_malloc_max_memory,
-	      (ulong) (sf_malloc_max_memory + 1023L) / 1024L);
-      my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
-    }
-    DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
-			(long)sf_malloc_max_memory,lineno, filename));
-    DBUG_EXECUTE_IF("simulate_out_of_memory",
-                    DBUG_SET("-d,simulate_out_of_memory"););
-    if (MyFlags & MY_FAE)
-      exit(1);
-    DBUG_RETURN ((void*) 0);
-  }
-
-  /* Fill up the structure */
-  data= (((uchar*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
-	 sf_malloc_prehunc);
-  *((uint32*) (data-sizeof(uint32)))= MAGICKEY;
-  data[size + 0]= MAGICEND0;
-  data[size + 1]= MAGICEND1;
-  data[size + 2]= MAGICEND2;
-  data[size + 3]= MAGICEND3;
-  irem->filename= (char *) filename;
-  irem->linenum= lineno;
-  irem->datasize= size;
-  irem->prev=	  NULL;
-
-  /* Add this remember structure to the linked list */
-  mysql_mutex_lock(&THR_LOCK_malloc);
-  if ((irem->next= sf_malloc_root))
-    sf_malloc_root->prev= irem;
-  sf_malloc_root= irem;
-
-  /* Keep the statistics */
-  sf_malloc_cur_memory+= size;
-  if (sf_malloc_cur_memory > sf_malloc_max_memory)
-    sf_malloc_max_memory= sf_malloc_cur_memory;
-  sf_malloc_count++;
-  mysql_mutex_unlock(&THR_LOCK_malloc);
-
-  MEM_CHECK_ADDRESSABLE(data, size);
-  /* Set the memory to the aribtrary wierd value */
-  if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick)
-    bfill(data, size, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL));
-  if (!(MyFlags & MY_ZEROFILL))
-    MEM_UNDEFINED(data, size);
-  /* Return a pointer to the real data */
-  DBUG_PRINT("exit",("ptr: %p", data));
-  if (sf_min_adress > data)
-    sf_min_adress= data;
-  if (sf_max_adress < data)
-    sf_max_adress= data;
-  DBUG_RETURN((void*) data);
-}
-
-
-/*
-  Allocate some new memory and move old memoryblock there.
-  Free then old memoryblock
-*/
-
-void *_myrealloc(register void *ptr, register size_t size,
-                 const char *filename, uint lineno, myf MyFlags)
-{
-  struct st_irem *irem;
-  char *data;
-  DBUG_ENTER("_myrealloc");
-
-  if (!ptr && (MyFlags & MY_ALLOW_ZERO_PTR))
-    DBUG_RETURN(_mymalloc(size, filename, lineno, MyFlags));
-
-  if (!sf_malloc_quick)
-    (void) _sanity (filename, lineno);
-
-  if (check_ptr("Reallocating", (uchar*) ptr, filename, lineno))
-    DBUG_RETURN((uchar*) NULL);
-
-  irem= (struct st_irem *) (((char*) ptr) - ALIGN_SIZE(sizeof(struct st_irem))-
-			    sf_malloc_prehunc);
-  if (*((uint32*) (((char*) ptr)- sizeof(uint32))) != MAGICKEY)
-  {
-    fprintf(stderr, "Error: Reallocating unallocated data at line %d, '%s'\n",
-	    lineno, filename);
-    DBUG_PRINT("safe",("Reallocating unallocated data at line %d, '%s'",
-		       lineno, filename));
-    (void) fflush(stderr);
-    DBUG_RETURN((uchar*) NULL);
-  }
-
-  if ((data= _mymalloc(size,filename,lineno,MyFlags))) /* Allocate new area */
-  {
-    size=min(size, irem->datasize);		/* Move as much as possibly */
-    memcpy((uchar*) data, ptr, (size_t) size);	/* Copy old data */
-    _myfree(ptr, filename, lineno, 0);		/* Free not needed area */
-  }
-  else
-  {
-    if (MyFlags & MY_HOLD_ON_ERROR)
-      DBUG_RETURN(ptr);
-    if (MyFlags & MY_FREE_ON_ERROR)
-      _myfree(ptr, filename, lineno, 0);
-  }
-  DBUG_RETURN(data);
-} /* _myrealloc */
-
-
-/* Deallocate some memory. */
-
-void _myfree(void *ptr, const char *filename, uint lineno, myf myflags)
-{
-  struct st_irem *irem;
-  DBUG_ENTER("_myfree");
-  DBUG_PRINT("enter",("ptr: %p", ptr));
-
-  if (!sf_malloc_quick)
-    (void) _sanity (filename, lineno);
-
-  if ((!ptr && (myflags & MY_ALLOW_ZERO_PTR)) ||
-      check_ptr("Freeing",(uchar*) ptr,filename,lineno))
-    DBUG_VOID_RETURN;
-
-  /* Calculate the address of the remember structure */
-  irem= (struct st_irem *) ((char*) ptr- ALIGN_SIZE(sizeof(struct st_irem))-
-			    sf_malloc_prehunc);
-
-  /*
-    Check to make sure that we have a real remember structure.
-    Note: this test could fail for four reasons:
-    (1) The memory was already free'ed
-    (2) The memory was never new'ed
-    (3) There was an underrun
-    (4) A stray pointer hit this location
-  */
-
-  if (*((uint32*) ((char*) ptr- sizeof(uint32))) != MAGICKEY)
-  {
-    fprintf(stderr, "Error: Freeing unallocated data at line %d, '%s'\n",
-	    lineno, filename);
-    DBUG_PRINT("safe",("Unallocated data at line %d, '%s'",lineno,filename));
-    (void) fflush(stderr);
-    DBUG_VOID_RETURN;
-  }
-
-  /* Remove this structure from the linked list */
-  mysql_mutex_lock(&THR_LOCK_malloc);
-  if (irem->prev)
-    irem->prev->next= irem->next;
-   else
-    sf_malloc_root= irem->next;
-
-  if (irem->next)
-    irem->next->prev= irem->prev;
-  /* Handle the statistics */
-  sf_malloc_cur_memory-= irem->datasize;
-  sf_malloc_count--;
-  mysql_mutex_unlock(&THR_LOCK_malloc);
-
-#ifndef HAVE_purify
-  /* Mark this data as free'ed */
-  if (!sf_malloc_quick)
-    bfill(ptr, irem->datasize, (pchar) FREE_VAL);
-#endif
-  MEM_NOACCESS(ptr, irem->datasize);
-  *((uint32*) ((char*) ptr- sizeof(uint32)))= ~MAGICKEY;
-  MEM_NOACCESS((char*) ptr - sizeof(uint32), sizeof(uint32));
-  /* Actually free the memory */
-  free((char*) irem);
-  DBUG_VOID_RETURN;
-}
-
-	/* Check if we have a wrong  pointer */
-
-static int check_ptr(const char *where, uchar *ptr, const char *filename,
-		     uint lineno)
-{
-  if (!ptr)
-  {
-    fprintf(stderr, "Error: %s NULL pointer at line %d, '%s'\n",
-	    where,lineno, filename);
-    DBUG_PRINT("safe",("Null pointer at line %d '%s'", lineno, filename));
-    (void) fflush(stderr);
-    return 1;
-  }
-#ifndef _MSC_VER
-  if ((long) ptr & (ALIGN_SIZE(1)-1))
-  {
-    fprintf(stderr, "Error: %s wrong aligned pointer at line %d, '%s'\n",
-	    where,lineno, filename);
-    DBUG_PRINT("safe",("Wrong aligned pointer at line %d, '%s'",
-		       lineno,filename));
-    (void) fflush(stderr);
-    return 1;
-  }
-#endif
-  if (ptr < sf_min_adress || ptr > sf_max_adress)
-  {
-    fprintf(stderr, "Error: %s pointer out of range at line %d, '%s'\n",
-	    where,lineno, filename);
-    DBUG_PRINT("safe",("Pointer out of range at line %d '%s'",
-		       lineno,filename));
-    (void) fflush(stderr);
-    return 1;
-  }
-  return 0;
-}
-
-
-/*
-  Report on all the memory pieces that have not been free'ed
-
-  SYNOPSIS
-    TERMINATE()
-    file   Write output to this file
-    flag   If <> 0, also write statistics 
- */
-
-void TERMINATE(FILE *file, uint flag)
-{
-  struct st_irem *irem;
-  DBUG_ENTER("TERMINATE");
-  mysql_mutex_lock(&THR_LOCK_malloc);
-
-  /*
-    Report the difference between number of calls to
-    NEW and the number of calls to FREE.  >0 means more
-    NEWs than FREEs.  <0, etc.
-  */
-
-  if (sf_malloc_count)
-  {
-    if (file)
-    {
-      fprintf(file, "Warning: Not freed memory segments: %u\n", sf_malloc_count);
-      (void) fflush(file);
-    }
-    DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count));
-  }
-
-  /*
-    Report on all the memory that was allocated with NEW
-    but not free'ed with FREE.
-  */
-
-  if ((irem= sf_malloc_root))
-  {
-    if (file)
-    {
-      fprintf(file, "Warning: Memory that was not free'ed (%lu bytes):\n",
-	      (ulong) sf_malloc_cur_memory);
-      (void) fflush(file);
-    }
-    DBUG_PRINT("safe",("Memory that was not free'ed (%lu bytes):",
-		       (ulong) sf_malloc_cur_memory));
-    while (irem)
-    {
-      char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
-		   sf_malloc_prehunc);
-      if (file)
-      {
-	fprintf(file,
-		"\t%6lu bytes at %p, allocated at line %4u in '%s'",
-		(ulong) irem->datasize, data, irem->linenum, irem->filename);
-	fprintf(file, "\n");
-	(void) fflush(file);
-      }
-      DBUG_PRINT("safe",
-		 ("%6lu bytes at %p, allocated at line %4d in '%s'",
-		  (ulong) irem->datasize,
-		  data, irem->linenum, irem->filename));
-      irem= irem->next;
-    }
-  }
-  /* Report the memory usage statistics */
-  if (file && flag)
-  {
-    fprintf(file, "Maximum memory usage: %lu bytes (%luk)\n",
-	    (ulong) sf_malloc_max_memory,
-	    (ulong) (sf_malloc_max_memory + 1023L) / 1024L);
-    (void) fflush(file);
-  }
-  DBUG_PRINT("safe",("Maximum memory usage: %lu bytes (%luk)",
-		     (ulong) sf_malloc_max_memory,
-		     (ulong) (sf_malloc_max_memory + 1023L) /1024L));
-  mysql_mutex_unlock(&THR_LOCK_malloc);
-  DBUG_VOID_RETURN;
-}
-
-
-/*
-  Report where a piece of memory was allocated
-
-  This is usefull to call from withing a debugger
-*/
-
-
-void sf_malloc_report_allocated(void *memory)
-{
-  struct st_irem *irem;  
-  for (irem= sf_malloc_root ; irem ; irem=irem->next)
-  {
-    char *data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
-                 sf_malloc_prehunc);
-    if (data <= (char*) memory && (char*) memory <= data + irem->datasize)
-    {
-      printf("%lu bytes at %p, allocated at line %u in '%s'\n",
-             (ulong) irem->datasize, data, irem->linenum, irem->filename);
-      break;
-    }
-  }
-}
-
-	/* Returns 0 if chunk is ok */
-
-static int _checkchunk(register struct st_irem *irem, const char *filename,
-		       uint lineno)
-{
-  int flag=0;
-  char *magicp, *data;
-
-  data= (((char*) irem) + ALIGN_SIZE(sizeof(struct st_irem)) +
-	 sf_malloc_prehunc);
-  /* Check for a possible underrun */
-  if (*((uint32*) (data- sizeof(uint32))) != MAGICKEY)
-  {
-    fprintf(stderr, "Error: Memory allocated at %s:%d was underrun,",
-	    irem->filename, irem->linenum);
-    fprintf(stderr, " discovered at %s:%d\n", filename, lineno);
-    (void) fflush(stderr);
-    DBUG_PRINT("safe",("Underrun at %p, allocated at %s:%d",
-		       data, irem->filename, irem->linenum));
-    flag=1;
-  }
-
-  /* Check for a possible overrun */
-  magicp= data + irem->datasize;
-  if (*magicp++ != MAGICEND0 ||
-      *magicp++ != MAGICEND1 ||
-      *magicp++ != MAGICEND2 ||
-      *magicp++ != MAGICEND3)
-  {
-    fprintf(stderr, "Error: Memory allocated at %s:%d was overrun,",
-	    irem->filename, irem->linenum);
-    fprintf(stderr, " discovered at '%s:%d'\n", filename, lineno);
-    (void) fflush(stderr);
-    DBUG_PRINT("safe",("Overrun at %p, allocated at %s:%d",
-		       data, irem->filename, irem->linenum));
-    flag=1;
-  }
-  return(flag);
-}
-
-
-	/* Returns how many wrong chunks */
-
-int _sanity(const char *filename, uint lineno)
-{
-  reg1 struct st_irem *irem;
-  reg2 int flag=0;
-  uint count=0;
-
-  mysql_mutex_lock(&THR_LOCK_malloc);
-#ifndef PEDANTIC_SAFEMALLOC  
-  if (sf_malloc_tampered && (int) sf_malloc_count < 0)
-    sf_malloc_count=0;
-#endif  
-  count=sf_malloc_count;
-  for (irem= sf_malloc_root; irem != NULL && count-- ; irem= irem->next)
-    flag+= _checkchunk (irem, filename, lineno);
-  mysql_mutex_unlock(&THR_LOCK_malloc);
-  if (count || irem)
-  {
-    const char *format="Error: Safemalloc link list destroyed, discovered at '%s:%d'";
-    fprintf(stderr, format, filename, lineno); fputc('\n',stderr);
-    fprintf(stderr, "root=%p,count=%d,irem=%p\n", sf_malloc_root,count,irem);
-    (void) fflush(stderr);
-    DBUG_PRINT("safe",(format, filename, lineno));
-    flag=1;
-  }
-  return flag;
-} /* _sanity */
-
-
-	/* malloc and copy */
-
-void *_my_memdup(const void *from, size_t length, const char *filename,
-                  uint lineno, myf MyFlags)
-{
-  void *ptr;
-  if ((ptr= _mymalloc(length,filename,lineno,MyFlags)) != 0)
-    memcpy(ptr, from, length);
-  return(ptr);
-} /*_my_memdup */
-
-
-char *_my_strdup(const char *from, const char *filename, uint lineno,
-		 myf MyFlags)
-{
-  char *ptr;
-  size_t length= strlen(from)+1;
-  if ((ptr= (char*) _mymalloc(length,filename,lineno,MyFlags)) != 0)
-    memcpy((uchar*) ptr, (uchar*) from, (size_t) length);
-  return(ptr);
-} /* _my_strdup */
-
-
-char *_my_strndup(const char *from, size_t length,
-                  const char *filename, uint lineno,
-                  myf MyFlags)
-{
-  char *ptr;
-  if ((ptr= (char*) _mymalloc(length+1,filename,lineno,MyFlags)) != 0)
-  {
-    memcpy((uchar*) ptr, (uchar*) from, (size_t) length);
-    ptr[length]=0;
-  }
-  return(ptr);
-}

=== modified file 'mysys/stacktrace.c'
--- a/mysys/stacktrace.c	2010-01-30 21:26:38 +0000
+++ b/mysys/stacktrace.c	2010-06-30 12:10:29 +0000
@@ -334,44 +334,9 @@ void my_write_core(int sig)
 
 #include <dbghelp.h>
 #include <tlhelp32.h>
-
-/*
-  Stack tracing on Windows is implemented using Debug Helper library(dbghelp.dll)
-  We do not redistribute dbghelp and the one comes with older OS (up to Windows 2000)
-  is missing some important functions like functions StackWalk64 or MinidumpWriteDump.
-  Hence, we have to load functions at runtime using LoadLibrary/GetProcAddress.
-*/
-
-typedef DWORD (WINAPI *SymSetOptions_FctType)(DWORD dwOptions);
-typedef BOOL  (WINAPI *SymGetModuleInfo64_FctType)
-  (HANDLE,DWORD64,PIMAGEHLP_MODULE64) ;
-typedef BOOL  (WINAPI *SymGetSymFromAddr64_FctType)
-  (HANDLE,DWORD64,PDWORD64,PIMAGEHLP_SYMBOL64) ;
-typedef BOOL  (WINAPI *SymGetLineFromAddr64_FctType)
-  (HANDLE,DWORD64,PDWORD,PIMAGEHLP_LINE64);
-typedef BOOL  (WINAPI *SymInitialize_FctType)
-  (HANDLE,PSTR,BOOL);
-typedef BOOL  (WINAPI *StackWalk64_FctType)
-  (DWORD,HANDLE,HANDLE,LPSTACKFRAME64,PVOID,PREAD_PROCESS_MEMORY_ROUTINE64,
-  PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64 ,
-  PTRANSLATE_ADDRESS_ROUTINE64);
-typedef BOOL (WINAPI *MiniDumpWriteDump_FctType)(
-    IN HANDLE hProcess,
-    IN DWORD ProcessId,
-    IN HANDLE hFile,
-    IN MINIDUMP_TYPE DumpType,
-    IN CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, OPTIONAL
-    IN CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, OPTIONAL
-    IN CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam OPTIONAL
-    );
-
-static SymSetOptions_FctType           pSymSetOptions;
-static SymGetModuleInfo64_FctType      pSymGetModuleInfo64;
-static SymGetSymFromAddr64_FctType     pSymGetSymFromAddr64;
-static SymInitialize_FctType           pSymInitialize;
-static StackWalk64_FctType             pStackWalk64;
-static SymGetLineFromAddr64_FctType    pSymGetLineFromAddr64;
-static MiniDumpWriteDump_FctType       pMiniDumpWriteDump;
+#if _MSC_VER
+#pragma comment(lib, "dbghelp")
+#endif
 
 static EXCEPTION_POINTERS *exception_ptrs;
 
@@ -382,50 +347,24 @@ void my_init_stacktrace()
 {
 }
 
-/*
-  Dynamically load dbghelp functions
-*/
-BOOL init_dbghelp_functions()
-{
-  static BOOL first_time= TRUE;
-  static BOOL rc;
-  HMODULE hDbghlp;
-
-  if(first_time)
-  {
-    first_time= FALSE;
-    hDbghlp= LoadLibrary("dbghelp");
-    if(!hDbghlp)
-    {
-      rc= FALSE;
-      return rc;
-    }
-    pSymSetOptions= (SymSetOptions_FctType)
-      GetProcAddress(hDbghlp,"SymSetOptions");
-    pSymInitialize= (SymInitialize_FctType)
-      GetProcAddress(hDbghlp,"SymInitialize");
-    pSymGetModuleInfo64= (SymGetModuleInfo64_FctType)
-      GetProcAddress(hDbghlp,"SymGetModuleInfo64");
-    pSymGetLineFromAddr64= (SymGetLineFromAddr64_FctType)
-      GetProcAddress(hDbghlp,"SymGetLineFromAddr64");
-    pSymGetSymFromAddr64=(SymGetSymFromAddr64_FctType)
-      GetProcAddress(hDbghlp,"SymGetSymFromAddr64");
-    pStackWalk64= (StackWalk64_FctType)
-      GetProcAddress(hDbghlp,"StackWalk64");
-    pMiniDumpWriteDump = (MiniDumpWriteDump_FctType)
-      GetProcAddress(hDbghlp,"MiniDumpWriteDump");
-
-    rc = (BOOL)(pSymSetOptions && pSymInitialize && pSymGetModuleInfo64
-    && pSymGetLineFromAddr64 && pSymGetSymFromAddr64 && pStackWalk64);
-  }
-  return rc;
-}
 
 void my_set_exception_pointers(EXCEPTION_POINTERS *ep)
 {
   exception_ptrs = ep;
 }
 
+/*
+  Appends directory to symbol path.
+*/
+static void add_to_symbol_path(char *path, size_t path_buffer_size, 
+  char *dir, size_t dir_buffer_size)
+{
+  strcat_s(dir, dir_buffer_size, ";");
+  if (!strstr(path, dir))
+  {
+    strcat_s(path, path_buffer_size, dir);
+  }
+}
 
 /*
   Get symbol path - semicolon-separated list of directories to search for debug
@@ -437,8 +376,28 @@ static void get_symbol_path(char *path, 
 { 
   HANDLE hSnap; 
   char *envvar;
+  char *p;
+#ifndef DBUG_OFF
+  static char pdb_debug_dir[MAX_PATH + 7];
+#endif
 
   path[0]= '\0';
+
+#ifndef DBUG_OFF
+  /* 
+    Add "debug" subdirectory of the application directory, sometimes PDB will 
+    placed here by installation.
+  */
+  GetModuleFileName(NULL, pdb_debug_dir, MAX_PATH);
+  p= strrchr(pdb_debug_dir, '\\');
+  if(p)
+  { 
+    *p= 0;
+    strcat_s(pdb_debug_dir, sizeof(pdb_debug_dir), "\\debug;");
+    add_to_symbol_path(path, size, pdb_debug_dir, sizeof(pdb_debug_dir));
+  }
+#endif
+
   /*
     Enumerate all modules, and add their directories to the path.
     Avoid duplicate entries.
@@ -452,7 +411,7 @@ static void get_symbol_path(char *path, 
     for (ret= Module32First(hSnap, &mod); ret; ret= Module32Next(hSnap, &mod))
     {
       char *module_dir= mod.szExePath;
-      char *p= strrchr(module_dir,'\\');
+      p= strrchr(module_dir,'\\');
       if (!p)
       {
         /*
@@ -460,29 +419,23 @@ static void get_symbol_path(char *path, 
           will indicate current directory.
         */
         module_dir[0]= '.';
-        p= module_dir + 1;
+        module_dir[1]= '\0';
       }
-      *p++= ';';
-      *p= '\0';
-
-      if (!strstr(path, module_dir))
+      else
       {
-        size_t dir_len = strlen(module_dir);
-        if (size > dir_len)
-        {
-          strncat(path, module_dir, size-1);
-          size -= dir_len;
-        }
+        *p= '\0';
       }
+      add_to_symbol_path(path, size, module_dir,sizeof(mod.szExePath));
     }
     CloseHandle(hSnap);
   }
 
+  
   /* Add _NT_SYMBOL_PATH, if present. */
   envvar= getenv("_NT_SYMBOL_PATH");
-  if(envvar && size)
+  if(envvar)
   {
-    strncat(path, envvar, size-1);
+    strcat_s(path, size, envvar);
   }
 }
 
@@ -506,15 +459,15 @@ void my_print_stacktrace(uchar* unused1,
   STACKFRAME64 frame={0};
   static char symbol_path[MAX_SYMBOL_PATH];
 
-  if(!exception_ptrs || !init_dbghelp_functions())
+  if(!exception_ptrs)
     return;
 
   /* Copy context, as stackwalking on original will unwind the stack */
   context = *(exception_ptrs->ContextRecord);
   /*Initialize symbols.*/
-  pSymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG);
+  SymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_NO_PROMPTS|SYMOPT_DEFERRED_LOADS|SYMOPT_DEBUG);
   get_symbol_path(symbol_path, sizeof(symbol_path));
-  pSymInitialize(hProcess, symbol_path, TRUE);
+  SymInitialize(hProcess, symbol_path, TRUE);
 
   /*Prepare stackframe for the first StackWalk64 call*/
   frame.AddrFrame.Mode= frame.AddrPC.Mode= frame.AddrStack.Mode= AddrModeFlat;
@@ -546,11 +499,11 @@ void my_print_stacktrace(uchar* unused1,
     BOOL have_symbol= FALSE;
     BOOL have_source= FALSE;
 
-    if(!pStackWalk64(machine, hProcess, hThread, &frame, &context, 0, 0, 0 ,0))
+    if(!StackWalk64(machine, hProcess, hThread, &frame, &context, 0, 0, 0 ,0))
       break;
     addr= frame.AddrPC.Offset;
 
-    have_module= pSymGetModuleInfo64(hProcess,addr,&module);
+    have_module= SymGetModuleInfo64(hProcess,addr,&module);
 #ifdef _M_IX86
     if(!have_module)
     {
@@ -560,13 +513,13 @@ void my_print_stacktrace(uchar* unused1,
         happy, pretend passing the old structure.
       */
       module.SizeOfStruct= MODULE64_SIZE_WINXP;
-      have_module= pSymGetModuleInfo64(hProcess, addr, &module);
+      have_module= SymGetModuleInfo64(hProcess, addr, &module);
     }
 #endif
 
-    have_symbol= pSymGetSymFromAddr64(hProcess, addr, &function_offset,
+    have_symbol= SymGetSymFromAddr64(hProcess, addr, &function_offset,
       &(package.sym));
-    have_source= pSymGetLineFromAddr64(hProcess, addr, &line_offset, &line);
+    have_source= SymGetLineFromAddr64(hProcess, addr, &line_offset, &line);
 
     fprintf(stderr, "%p    ", addr);
     if(have_module)
@@ -610,7 +563,7 @@ void my_write_core(int unused)
   MINIDUMP_EXCEPTION_INFORMATION info;
   HANDLE hFile;
 
-  if(!exception_ptrs || !init_dbghelp_functions() || !pMiniDumpWriteDump)
+  if(!exception_ptrs)
     return;
 
   info.ExceptionPointers= exception_ptrs;
@@ -628,7 +581,7 @@ void my_write_core(int unused)
   if(hFile)
   {
     /* Create minidump */
-    if(pMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
+    if(MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
       hFile, MiniDumpNormal, &info, 0, 0))
     {
       fprintf(stderr, "Minidump written to %s\n",

=== modified file 'mysys/string.c'
--- a/mysys/string.c	2009-02-13 16:41:47 +0000
+++ b/mysys/string.c	2010-07-08 21:20:08 +0000
@@ -177,9 +177,6 @@ my_bool dynstr_append_os_quoted(DYNAMIC_
 
 void dynstr_free(DYNAMIC_STRING *str)
 {
-  if (str->str)
-  {
-    my_free(str->str,MYF(MY_WME));
-    str->str=0;
-  }
+  my_free(str->str);
+  str->str= NULL;
 }

=== modified file 'mysys/test_charset.c'
--- a/mysys/test_charset.c	2007-08-15 13:43:08 +0000
+++ b/mysys/test_charset.c	2010-07-08 21:20:08 +0000
@@ -80,11 +80,11 @@ int main(int argc, char **argv) {
 #ifdef NOT_USED_ANYMORE
   cs_list = list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
   printf("LIST OF CHARSETS (compiled + *.conf):\n%s\n", cs_list);
-  my_free(cs_list,MYF(0));
+  my_free(cs_list);
 
   cs_list = list_charsets(MYF(MY_CS_INDEX | MY_CS_LOADED));
   printf("LIST OF CHARSETS (index + loaded):\n%s\n", cs_list);
-  my_free(cs_list,MYF(0));
+  my_free(cs_list);
 #endif
 
   return 0;

=== modified file 'mysys/testhash.c'
--- a/mysys/testhash.c	2007-05-10 09:59:39 +0000
+++ b/mysys/testhash.c	2010-07-08 21:20:08 +0000
@@ -286,5 +286,5 @@ static int rnd(int max_value)
 
 void free_record(void *record)
 {
-  my_free(record,MYF(0));
+  my_free(record);
 }

=== modified file 'mysys/thr_alarm.c'
--- a/mysys/thr_alarm.c	2009-12-10 03:19:51 +0000
+++ b/mysys/thr_alarm.c	2010-07-08 21:20:08 +0000
@@ -262,7 +262,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
     {
       queue_remove(&alarm_queue,i),MYF(0);
       if (alarm_data->malloced)
-	my_free((uchar*) alarm_data,MYF(0));
+	my_free(alarm_data);
       found++;
 #ifdef DBUG_OFF
       break;

=== modified file 'mysys/tree.c'
--- a/mysys/tree.c	2007-05-10 09:59:39 +0000
+++ b/mysys/tree.c	2010-07-08 21:20:08 +0000
@@ -183,7 +183,7 @@ static void delete_tree_element(TREE *tr
       (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg);
     delete_tree_element(tree,element->right);
     if (tree->with_delete)
-      my_free((char*) element,MYF(0));
+      my_free(element);
   }
 }
 
@@ -326,7 +326,7 @@ int tree_delete(TREE *tree, void *key, u
   if (tree->free)
     (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg);
   tree->allocated-= sizeof(TREE_ELEMENT) + tree->size_of_element + key_size;
-  my_free((uchar*) element,MYF(0));
+  my_free(element);
   tree->elements_in_tree--;
   return 0;
 }

=== modified file 'mysys/trie.c'
--- a/mysys/trie.c	2007-05-10 09:59:39 +0000
+++ b/mysys/trie.c	2010-07-08 21:20:08 +0000
@@ -211,7 +211,7 @@ my_bool ac_trie_prepare (TRIE *trie)
         fail= fail->fail;
     }
   }
-  my_free((uchar*)tmp_nodes, MYF(0));
+  my_free(tmp_nodes);
   DBUG_RETURN(FALSE);
 }
 

=== modified file 'packaging/WiX/CPackWixConfig.cmake'
--- a/packaging/WiX/CPackWixConfig.cmake	2010-02-16 15:17:10 +0000
+++ b/packaging/WiX/CPackWixConfig.cmake	2010-06-30 12:10:29 +0000
@@ -7,7 +7,7 @@ IF(ESSENTIALS)
  SET(CPACK_PACKAGE_FILE_NAME  "mysql-essentials-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}-win${bits}")
 ELSE()
   SET(CPACK_COMPONENTS_USED 
-    "Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts")
+    "Server;Client;DataFiles;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts;DebugBinaries")
 ENDIF()
 
 
@@ -45,6 +45,13 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DE
  SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
  SET(CPACK_COMPONENT_CLIENT_DESCRIPTION 
    "Various helpful (commandline) tools including the mysql command line client" )
+ # Subfeature "Debug binaries" 
+ SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION 
+   "Debug/trace versions of executables and libraries" )
+ #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
+  
    
  #Subfeature "Data Files" 
  SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")

=== modified file 'plugin/daemon_example/daemon_example.cc'
--- a/plugin/daemon_example/daemon_example.cc	2010-05-27 11:52:01 +0000
+++ b/plugin/daemon_example/daemon_example.cc	2010-07-08 21:20:08 +0000
@@ -175,7 +175,7 @@ static int daemon_example_plugin_deinit(
   my_write(con->heartbeat_file, (uchar*) buffer, strlen(buffer), MYF(0));
   my_close(con->heartbeat_file, MYF(0));
 
-  my_free((char *)con, MYF(0));
+  my_free(con);
 
   DBUG_RETURN(0);
 }

=== modified file 'plugin/semisync/semisync_master.h'
--- a/plugin/semisync/semisync_master.h	2010-06-05 19:39:03 +0000
+++ b/plugin/semisync/semisync_master.h	2010-07-08 21:20:08 +0000
@@ -255,7 +255,7 @@ private:
    */
   void free_block(Block *block)
   {
-    my_free(block, MYF(0));
+    my_free(block);
     --block_num;
   }
 

=== modified file 'scripts/mysql_config.pl.in'
--- a/scripts/mysql_config.pl.in	2009-09-08 13:35:01 +0000
+++ b/scripts/mysql_config.pl.in	2010-07-08 21:20:08 +0000
@@ -42,8 +42,7 @@ use Cwd;
 use strict;
 
 my @exclude_cflags =
-  qw/DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX
-     DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
+  qw/DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
      DEXTRA_DEBUG DHAVE_purify O O[0-9] xO[0-9] W[-A-Za-z]*
      Xa xstrconst xc99=none
      unroll2 ip mp restrict/;

=== modified file 'scripts/mysql_config.sh'
--- a/scripts/mysql_config.sh	2009-09-22 23:26:08 +0000
+++ b/scripts/mysql_config.sh	2010-07-08 21:20:08 +0000
@@ -127,8 +127,7 @@ include="-I$pkgincludedir"
 #       and -xstrconst to make --cflags usable for Sun Forte C++
 # FIXME until we have a --cxxflags, we need to remove -AC99
 #       to make --cflags usable for HP C++ (aCC)
-for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
-              DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
+for remove in DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
               DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \
               'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \
               Xa xstrconst "xc99=none" AC99 \

=== modified file 'sql-common/client.c'
--- a/sql-common/client.c	2010-05-11 08:27:53 +0000
+++ b/sql-common/client.c	2010-07-08 21:20:08 +0000
@@ -688,8 +688,7 @@ err2:
       CloseHandle(handle_file_map);
   }
 err:
-  if (tmp)
-    my_free(tmp, MYF(0));
+  my_free(tmp);
   if (error_allow)
     error_code = GetLastError();
   if (event_connect_request)
@@ -802,7 +801,7 @@ void free_rows(MYSQL_DATA *cur)
   if (cur)
   {
     free_root(&cur->alloc,MYF(0));
-    my_free((uchar*) cur,MYF(0));
+    my_free(cur);
   }
 }
 
@@ -1127,9 +1126,8 @@ mysql_free_result(MYSQL_RES *result)
     free_rows(result->data);
     if (result->fields)
       free_root(&result->field_alloc,MYF(0));
-    if (result->row)
-      my_free((uchar*) result->row,MYF(0));
-    my_free((uchar*) result,MYF(0));
+    my_free(result->row);
+    my_free(result);
   }
   DBUG_VOID_RETURN;
 }
@@ -1167,13 +1165,13 @@ static int add_init_command(struct st_my
   {
     options->init_commands= (DYNAMIC_ARRAY*)my_malloc(sizeof(DYNAMIC_ARRAY),
 						      MYF(MY_WME));
-    init_dynamic_array(options->init_commands,sizeof(char*),0,5 CALLER_INFO);
+    init_dynamic_array(options->init_commands,sizeof(char*),0,5);
   }
 
   if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
       insert_dynamic(options->init_commands, (uchar*)&tmp))
   {
-    my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(tmp);
     return 1;
   }
 
@@ -1221,7 +1219,7 @@ void mysql_read_default_options(struct s
 	case 2:				/* socket */
 	  if (opt_arg)
 	  {
-	    my_free(options->unix_socket,MYF(MY_ALLOW_ZERO_PTR));
+	    my_free(options->unix_socket);
 	    options->unix_socket=my_strdup(opt_arg,MYF(MY_WME));
 	  }
 	  break;
@@ -1232,7 +1230,7 @@ void mysql_read_default_options(struct s
 	case 4:				/* password */
 	  if (opt_arg)
 	  {
-	    my_free(options->password,MYF(MY_ALLOW_ZERO_PTR));
+	    my_free(options->password);
 	    options->password=my_strdup(opt_arg,MYF(MY_WME));
 	  }
 	  break;
@@ -1246,7 +1244,7 @@ void mysql_read_default_options(struct s
 	case 7:				/* user */
 	  if (opt_arg)
 	  {
-	    my_free(options->user,MYF(MY_ALLOW_ZERO_PTR));
+	    my_free(options->user);
 	    options->user=my_strdup(opt_arg,MYF(MY_WME));
 	  }
 	  break;
@@ -1256,14 +1254,14 @@ void mysql_read_default_options(struct s
 	case 9:				/* host */
 	  if (opt_arg)
 	  {
-	    my_free(options->host,MYF(MY_ALLOW_ZERO_PTR));
+	    my_free(options->host);
 	    options->host=my_strdup(opt_arg,MYF(MY_WME));
 	  }
 	  break;
 	case 10:			/* database */
 	  if (opt_arg)
 	  {
-	    my_free(options->db,MYF(MY_ALLOW_ZERO_PTR));
+	    my_free(options->db);
 	    options->db=my_strdup(opt_arg,MYF(MY_WME));
 	  }
 	  break;
@@ -1277,23 +1275,23 @@ void mysql_read_default_options(struct s
 	  break;
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
 	case 13:			/* ssl_key */
-	  my_free(options->ssl_key, MYF(MY_ALLOW_ZERO_PTR));
+	  my_free(options->ssl_key);
           options->ssl_key = my_strdup(opt_arg, MYF(MY_WME));
           break;
 	case 14:			/* ssl_cert */
-	  my_free(options->ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
+	  my_free(options->ssl_cert);
           options->ssl_cert = my_strdup(opt_arg, MYF(MY_WME));
           break;
 	case 15:			/* ssl_ca */
-	  my_free(options->ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
+	  my_free(options->ssl_ca);
           options->ssl_ca = my_strdup(opt_arg, MYF(MY_WME));
           break;
 	case 16:			/* ssl_capath */
-	  my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
+	  my_free(options->ssl_capath);
           options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME));
           break;
         case 23:			/* ssl_cipher */
-          my_free(options->ssl_cipher, MYF(MY_ALLOW_ZERO_PTR));
+          my_free(options->ssl_cipher);
           options->ssl_cipher= my_strdup(opt_arg, MYF(MY_WME));
           break;
 #else
@@ -1305,11 +1303,11 @@ void mysql_read_default_options(struct s
 	  break;
 #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
 	case 17:			/* charset-lib */
-	  my_free(options->charset_dir,MYF(MY_ALLOW_ZERO_PTR));
+	  my_free(options->charset_dir);
           options->charset_dir = my_strdup(opt_arg, MYF(MY_WME));
 	  break;
 	case 18:
-	  my_free(options->charset_name,MYF(MY_ALLOW_ZERO_PTR));
+	  my_free(options->charset_name);
           options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
 	  break;
 	case 19:				/* Interactive-timeout */
@@ -1339,7 +1337,7 @@ void mysql_read_default_options(struct s
         case 26: /* shared_memory_base_name */
 #ifdef HAVE_SMEM
           if (options->shared_memory_base_name != def_shared_memory_base_name)
-            my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+            my_free(options->shared_memory_base_name);
           options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME));
 #endif
           break;
@@ -1760,14 +1758,14 @@ mysql_ssl_free(MYSQL *mysql __attribute_
   struct st_VioSSLFd *ssl_fd= (struct st_VioSSLFd*) mysql->connector_fd;
   DBUG_ENTER("mysql_ssl_free");
 
-  my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.ssl_capath, MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.ssl_cipher, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(mysql->options.ssl_key);
+  my_free(mysql->options.ssl_cert);
+  my_free(mysql->options.ssl_ca);
+  my_free(mysql->options.ssl_capath);
+  my_free(mysql->options.ssl_cipher);
   if (ssl_fd)
     SSL_CTX_free(ssl_fd->ssl_context);
-  my_free(mysql->connector_fd,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(mysql->connector_fd);
   mysql->options.ssl_key = 0;
   mysql->options.ssl_cert = 0;
   mysql->options.ssl_ca = 0;
@@ -2271,8 +2269,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
 			       (mysql->options.my_cnf_file ?
 				mysql->options.my_cnf_file : "my"),
 			       mysql->options.my_cnf_group);
-    my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
-    my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mysql->options.my_cnf_file);
+    my_free(mysql->options.my_cnf_group);
     mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
   }
 
@@ -3014,7 +3012,7 @@ mysql_select_db(MYSQL *mysql, const char
   if ((error=simple_command(mysql,COM_INIT_DB, (const uchar*) db,
                             (ulong) strlen(db),0)))
     DBUG_RETURN(error);
-  my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(mysql->db);
   mysql->db=my_strdup(db,MYF(MY_WME));
   DBUG_RETURN(0);
 }
@@ -3029,32 +3027,32 @@ static void mysql_close_free_options(MYS
 {
   DBUG_ENTER("mysql_close_free_options");
 
-  my_free(mysql->options.user,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.host,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.password,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.unix_socket,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.db,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->options.client_ip,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(mysql->options.user);
+  my_free(mysql->options.host);
+  my_free(mysql->options.password);
+  my_free(mysql->options.unix_socket);
+  my_free(mysql->options.db);
+  my_free(mysql->options.my_cnf_file);
+  my_free(mysql->options.my_cnf_group);
+  my_free(mysql->options.charset_dir);
+  my_free(mysql->options.charset_name);
+  my_free(mysql->options.client_ip);
   if (mysql->options.init_commands)
   {
     DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
     char **ptr= (char**)init_commands->buffer;
     char **end= ptr + init_commands->elements;
     for (; ptr<end; ptr++)
-      my_free(*ptr,MYF(MY_WME));
+      my_free(*ptr);
     delete_dynamic(init_commands);
-    my_free((char*)init_commands,MYF(MY_WME));
+    my_free(init_commands);
   }
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
   mysql_ssl_free(mysql);
 #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
 #ifdef HAVE_SMEM
   if (mysql->options.shared_memory_base_name != def_shared_memory_base_name)
-    my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mysql->options.shared_memory_base_name);
 #endif /* HAVE_SMEM */
   bzero((char*) &mysql->options,sizeof(mysql->options));
   DBUG_VOID_RETURN;
@@ -3063,12 +3061,12 @@ static void mysql_close_free_options(MYS
 
 static void mysql_close_free(MYSQL *mysql)
 {
-  my_free((uchar*) mysql->host_info,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->user,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->passwd,MYF(MY_ALLOW_ZERO_PTR));
-  my_free(mysql->db,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(mysql->host_info);
+  my_free(mysql->user);
+  my_free(mysql->passwd);
+  my_free(mysql->db);
 #if defined(EMBEDDED_LIBRARY) || MYSQL_VERSION_ID >= 50100
-  my_free(mysql->info_buffer,MYF(MY_ALLOW_ZERO_PTR));
+  my_free(mysql->info_buffer);
   mysql->info_buffer= 0;
 #endif
   /* Clear pointers for better safety */
@@ -3176,7 +3174,7 @@ void STDCALL mysql_close(MYSQL *mysql)
       (*mysql->methods->free_embedded_thd)(mysql);
 #endif
     if (mysql->free_me)
-      my_free((uchar*) mysql,MYF(0));
+      my_free(mysql);
   }
   DBUG_VOID_RETURN;
 }
@@ -3313,7 +3311,7 @@ MYSQL_RES * STDCALL mysql_store_result(M
   if (!(result->data=
 	(*mysql->methods->read_rows)(mysql,mysql->fields,mysql->field_count)))
   {
-    my_free((uchar*) result,MYF(0));
+    my_free(result);
     DBUG_RETURN(0);
   }
   mysql->affected_rows= result->row_count= result->data->rows;
@@ -3361,7 +3359,7 @@ static MYSQL_RES * cli_use_result(MYSQL 
   if (!(result->row=(MYSQL_ROW)
 	my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
   {					/* Ptrs: to one row */
-    my_free((uchar*) result,MYF(0));
+    my_free(result);
     DBUG_RETURN(0);
   }
   result->fields=	mysql->fields;
@@ -3482,19 +3480,19 @@ mysql_options(MYSQL *mysql,enum mysql_op
     add_init_command(&mysql->options,arg);
     break;
   case MYSQL_READ_DEFAULT_FILE:
-    my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mysql->options.my_cnf_file);
     mysql->options.my_cnf_file=my_strdup(arg,MYF(MY_WME));
     break;
   case MYSQL_READ_DEFAULT_GROUP:
-    my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mysql->options.my_cnf_group);
     mysql->options.my_cnf_group=my_strdup(arg,MYF(MY_WME));
     break;
   case MYSQL_SET_CHARSET_DIR:
-    my_free(mysql->options.charset_dir,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mysql->options.charset_dir);
     mysql->options.charset_dir=my_strdup(arg,MYF(MY_WME));
     break;
   case MYSQL_SET_CHARSET_NAME:
-    my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
+    my_free(mysql->options.charset_name);
     mysql->options.charset_name=my_strdup(arg,MYF(MY_WME));
     break;
   case MYSQL_OPT_PROTOCOL:
@@ -3503,7 +3501,7 @@ mysql_options(MYSQL *mysql,enum mysql_op
   case MYSQL_SHARED_MEMORY_BASE_NAME:
 #ifdef HAVE_SMEM
     if (mysql->options.shared_memory_base_name != def_shared_memory_base_name)
-      my_free(mysql->options.shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
+      my_free(mysql->options.shared_memory_base_name);
     mysql->options.shared_memory_base_name=my_strdup(arg,MYF(MY_WME));
 #endif
     break;

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2010-06-21 13:08:16 +0000
+++ b/sql/CMakeLists.txt	2010-06-30 12:10:29 +0000
@@ -156,7 +156,10 @@ IF(WITH_MYSQLD_LDFLAGS)
   SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS 
      "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}")
 ENDIF()
-INSTALL_DEBUG_TARGET(mysqld DESTINATION ${INSTALL_SBINDIR} RENAME mysqld-debug)
+INSTALL_DEBUG_TARGET(mysqld 
+  DESTINATION ${INSTALL_SBINDIR} 
+  PDB_DESTINATION ${INSTALL_SBINDIR}/debug
+  RENAME mysqld-debug)
 
 # Handle out-of-source build from source package with possibly broken 
 # bison. Copy bison output to from source to build directory, if not already 

=== modified file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc	2010-06-05 19:39:03 +0000
+++ b/sql/debug_sync.cc	2010-07-08 21:20:08 +0000
@@ -626,7 +626,7 @@ void debug_sync_end_thread(THD *thd)
         action->wait_for.free();
         action->sync_point.free();
       }
-      my_free(ds_control->ds_action, MYF(0));
+      my_free(ds_control->ds_action);
     }
 
     /* Statistics. */
@@ -637,7 +637,7 @@ void debug_sync_end_thread(THD *thd)
       debug_sync_global.dsp_max_active=    ds_control->dsp_max_active;
     mysql_mutex_unlock(&debug_sync_global.ds_mutex);
 
-    my_free(ds_control, MYF(0));
+    my_free(ds_control);
     thd->debug_sync_control= NULL;
   }
 

=== modified file 'sql/derror.cc'
--- a/sql/derror.cc	2010-05-31 15:29:54 +0000
+++ b/sql/derror.cc	2010-07-08 21:20:08 +0000
@@ -79,7 +79,7 @@ bool init_errmessage(void)
   /* Register messages for use with my_error(). */
   if (my_error_register(get_server_errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST))
   {
-    x_free((uchar*) errmsgs);
+    my_free(errmsgs);
     DBUG_RETURN(TRUE);
   }
 
@@ -155,7 +155,8 @@ Check that the above file is the right v
     DBUG_RETURN(1);
   }
 
-  x_free((uchar*) *point);		/* Free old language */
+  /* Free old language */
+  my_free(*point);
   if (!(*point= (const char**)
 	my_malloc((size_t) (length+count*sizeof(char*)),MYF(0))))
   {

=== modified file 'sql/event_data_objects.cc'
--- a/sql/event_data_objects.cc	2010-06-11 13:54:39 +0000
+++ b/sql/event_data_objects.cc	2010-07-08 21:20:08 +0000
@@ -176,7 +176,7 @@ Event_queue_element_for_exec::init(LEX_S
     return TRUE;
   if (!(name.str= my_strndup(n.str, name.length= n.length, MYF(MY_WME))))
   {
-    my_free((uchar*) dbname.str, MYF(0));
+    my_free(dbname.str);
     return TRUE;
   }
   return FALSE;
@@ -192,8 +192,8 @@ Event_queue_element_for_exec::init(LEX_S
 
 Event_queue_element_for_exec::~Event_queue_element_for_exec()
 {
-  my_free((uchar*) dbname.str, MYF(0));
-  my_free((uchar*) name.str, MYF(0));
+  my_free(dbname.str);
+  my_free(name.str);
 }
 
 

=== modified file 'sql/event_scheduler.cc'
--- a/sql/event_scheduler.cc	2010-06-10 11:43:32 +0000
+++ b/sql/event_scheduler.cc	2010-07-08 21:20:08 +0000
@@ -238,7 +238,7 @@ event_scheduler_thread(void *arg)
   res= post_init_event_thread(thd);
 
   DBUG_ENTER("event_scheduler_thread");
-  my_free((char*)arg, MYF(0));
+  my_free(arg);
   if (!res)
     scheduler->run(thd);
 

=== modified file 'sql/examples/CMakeLists.txt'
--- a/sql/examples/CMakeLists.txt	2006-12-31 00:02:27 +0000
+++ b/sql/examples/CMakeLists.txt	2010-07-08 21:20:08 +0000
@@ -13,8 +13,8 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
-SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFE_MUTEX")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFE_MUTEX")
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql
                     ${CMAKE_SOURCE_DIR}/extra/yassl/include

=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc	2010-04-29 20:33:06 +0000
+++ b/sql/filesort.cc	2010-07-09 01:19:57 +0000
@@ -264,7 +264,7 @@ ha_rows filesort(THD *thd, TABLE *table,
   {
     if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
     {
-      x_free(table_sort.buffpek);
+      my_free(table_sort.buffpek);
       table_sort.buffpek= 0;
     }
     if (!(table_sort.buffpek=
@@ -304,13 +304,12 @@ ha_rows filesort(THD *thd, TABLE *table,
   error =0;
 
  err:
-  if (param.tmp_buffer)
-    x_free(param.tmp_buffer);
+  my_free(param.tmp_buffer);
   if (!subselect || !subselect->is_uncacheable())
   {
-    x_free((uchar*) sort_keys);
+    my_free(sort_keys);
     table_sort.sort_keys= 0;
-    x_free((uchar*) buffpek);
+    my_free(buffpek);
     table_sort.buffpek= 0;
     table_sort.buffpek_len= 0;
   }
@@ -347,32 +346,22 @@ ha_rows filesort(THD *thd, TABLE *table,
 
 void filesort_free_buffers(TABLE *table, bool full)
 {
-  if (table->sort.record_pointers)
-  {
-    my_free((uchar*) table->sort.record_pointers,MYF(0));
-    table->sort.record_pointers=0;
-  }
+  my_free(table->sort.record_pointers);
+  table->sort.record_pointers= NULL;
+
   if (full)
   {
-    if (table->sort.sort_keys )
-    {
-      x_free((uchar*) table->sort.sort_keys);
-      table->sort.sort_keys= 0;
-    }
-    if (table->sort.buffpek)
-    {
-      x_free((uchar*) table->sort.buffpek);
-      table->sort.buffpek= 0;
-      table->sort.buffpek_len= 0;
-    }
-  }
-  if (table->sort.addon_buf)
-  {
-    my_free((char *) table->sort.addon_buf, MYF(0));
-    my_free((char *) table->sort.addon_field, MYF(MY_ALLOW_ZERO_PTR));
-    table->sort.addon_buf=0;
-    table->sort.addon_field=0;
+    my_free(table->sort.sort_keys);
+    table->sort.sort_keys= NULL;
+    my_free(table->sort.buffpek);
+    table->sort.buffpek= NULL;
+    table->sort.buffpek_len= 0;
   }
+
+  my_free(table->sort.addon_buf);
+  my_free(table->sort.addon_field);
+  table->sort.addon_buf= NULL;
+  table->sort.addon_field= NULL;
 }
 
 /** Make a array of string pointers. */
@@ -413,7 +402,7 @@ static uchar *read_buffpek_from_file(IO_
     if (reinit_io_cache(buffpek_pointers,READ_CACHE,0L,0,0) ||
 	my_b_read(buffpek_pointers, (uchar*) tmp, length))
     {
-      my_free((char*) tmp, MYF(0));
+      my_free(tmp);
       tmp=0;
     }
   }

=== modified file 'sql/gstream.h'
--- a/sql/gstream.h	2010-03-31 14:05:33 +0000
+++ b/sql/gstream.h	2010-07-08 21:20:08 +0000
@@ -45,7 +45,7 @@ public:
   {}
   ~Gis_read_stream()
   {
-    my_free((uchar*) m_err_msg, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(m_err_msg);
   }
 
   enum enum_tok_types get_next_toc_type();

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2010-06-10 11:43:32 +0000
+++ b/sql/ha_ndbcluster.cc	2010-07-08 21:20:08 +0000
@@ -1035,7 +1035,7 @@ int get_ndb_blobs_value(TABLE* table, Nd
     }
     if (loop == 0 && offset > buffer_size)
     {
-      my_free(buffer, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(buffer);
       buffer_size= 0;
       DBUG_PRINT("info", ("allocate blobs buffer size %u", offset));
       buffer= (uchar*) my_malloc(offset, MYF(MY_WME));
@@ -1188,8 +1188,8 @@ int ha_ndbcluster::get_metadata(const ch
   if (readfrm(path, &data, &length) ||
       packfrm(data, length, &pack_data, &pack_length))
   {
-    my_free(data, MYF(MY_ALLOW_ZERO_PTR));
-    my_free(pack_data, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(data);
+    my_free(pack_data);
     DBUG_RETURN(1);
   }
     
@@ -1208,8 +1208,8 @@ int ha_ndbcluster::get_metadata(const ch
     DBUG_DUMP("frm", (uchar*) tab->getFrmData(), tab->getFrmLength());
     error= HA_ERR_TABLE_DEF_CHANGED;
   }
-  my_free((char*)data, MYF(0));
-  my_free((char*)pack_data, MYF(0));
+  my_free(data);
+  my_free(pack_data);
 
   if (error)
     goto err;
@@ -1235,7 +1235,7 @@ static int fix_unique_index_attr_order(N
   unsigned sz= index->getNoOfIndexColumns();
 
   if (data.unique_index_attrid_map)
-    my_free((char*)data.unique_index_attrid_map, MYF(0));
+    my_free(data.unique_index_attrid_map);
   data.unique_index_attrid_map= (uchar*)my_malloc(sz,MYF(MY_WME));
   if (data.unique_index_attrid_map == 0)
   {
@@ -1313,7 +1313,7 @@ static void ndb_clear_index(NDB_INDEX_DA
 {
   if (data.unique_index_attrid_map)
   {
-    my_free((char*)data.unique_index_attrid_map, MYF(0));
+    my_free(data.unique_index_attrid_map);
   }
   if (data.index_stat)
   {
@@ -5399,15 +5399,15 @@ int ha_ndbcluster::create(const char *na
     DBUG_RETURN(1);
   if (packfrm(data, length, &pack_data, &pack_length))
   {
-    my_free((char*)data, MYF(0));
+    my_free(data);
     DBUG_RETURN(2);
   }
   DBUG_PRINT("info",
              ("setFrm data: 0x%lx  len: %lu", (long) pack_data,
               (ulong) pack_length));
   tab.setFrm(pack_data, pack_length);      
-  my_free((char*)data, MYF(0));
-  my_free((char*)pack_data, MYF(0));
+  my_free(data);
+  my_free(pack_data);
   
   /*
     Check for disk options
@@ -5751,8 +5751,8 @@ int ha_ndbcluster::create_handler_files(
       packfrm(data, length, &pack_data, &pack_length))
   {
     DBUG_PRINT("info", ("Missing frm for %s", m_tabname));
-    my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
-    my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(data);
+    my_free(pack_data);
     error= 1;
   }
   else
@@ -5766,8 +5766,8 @@ int ha_ndbcluster::create_handler_files(
       set_ndb_err(current_thd, dict->getNdbError());
       error= ndb_to_mysql_error(&dict->getNdbError());
     }
-    my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
-    my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(data);
+    my_free(pack_data);
   }
   
   set_ndb_share_state(m_share, NSS_INITIAL);
@@ -6565,7 +6565,7 @@ ha_ndbcluster::~ha_ndbcluster() 
     free_share(&m_share);
   }
   release_metadata(thd, ndb);
-  my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(m_blobs_buffer);
   m_blobs_buffer= 0;
 
   // Check for open cursor/transaction
@@ -6911,7 +6911,7 @@ int ndbcluster_discover(handlerton *hton
 
   DBUG_RETURN(0);
 err:
-  my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(data);
   if (share)
   {
     /* ndb_share reference temporary free */
@@ -7177,8 +7177,8 @@ int ndbcluster_find_all_files(THD *thd)
           free_share(&share);
         }
       }
-      my_free((char*) data, MYF(MY_ALLOW_ZERO_PTR));
-      my_free((char*) pack_data, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(data);
+      my_free(pack_data);
 
       mysql_mutex_lock(&LOCK_open);
       if (discover)
@@ -8681,7 +8681,7 @@ NDB_SHARE *ndbcluster_get_share(const ch
       if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share))
       {
         free_root(&share->mem_root, MYF(0));
-        my_free((uchar*) share, 0);
+        my_free(share);
         *root_ptr= old_root;
         if (!have_lock)
           mysql_mutex_unlock(&ndbcluster_mutex);
@@ -8752,7 +8752,7 @@ void ndbcluster_real_free_share(NDB_SHAR
   }
 #endif
   free_root(&(*share)->mem_root, MYF(0));
-  my_free((uchar*) *share, MYF(0));
+  my_free(*share);
   *share= 0;
 
   dbug_print_open_tables();
@@ -10076,7 +10076,7 @@ int ha_ndbcluster::set_range_data(void *
   }
   tab->setRangeListData(range_data, sizeof(int32)*part_info->num_parts);
 error:
-  my_free((char*)range_data, MYF(0));
+  my_free(range_data);
   DBUG_RETURN(error);
 }
 
@@ -10113,7 +10113,7 @@ int ha_ndbcluster::set_list_data(void *t
   }
   tab->setRangeListData(list_data, 2*sizeof(int32)*part_info->num_list_values);
 error:
-  my_free((char*)list_data, MYF(0));
+  my_free(list_data);
   DBUG_RETURN(error);
 }
 

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2010-06-17 13:31:51 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2010-07-08 21:20:08 +0000
@@ -1020,7 +1020,7 @@ static void ndbcluster_get_schema(NDB_SH
                                  ptrdiff);
     if (ret != 0)
     {
-      my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(blobs_buffer);
       DBUG_PRINT("info", ("blob read error"));
       DBUG_ASSERT(FALSE);
     }
@@ -1071,7 +1071,7 @@ static void ndbcluster_get_schema(NDB_SH
   field++;
   s->type= ((Field_long *)*field)->val_int();
   /* free blobs buffer */
-  my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(blobs_buffer);
   dbug_tmp_restore_column_map(table->read_set, old_map);
 }
 
@@ -1739,7 +1739,7 @@ ndb_handle_schema_change(THD *thd, Ndb *
           old->getObjectVersion() != altered_table->getObjectVersion())
         dict->putTable(altered_table);
       
-      my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
+      my_free(data);
       data= NULL;
       if ((error= unpackfrm(&data, &length,
                             (const uchar*) altered_table->getFrmData())) ||
@@ -1772,8 +1772,8 @@ ndb_handle_schema_change(THD *thd, Ndb *
 
       mysql_mutex_unlock(&LOCK_open);
     }
-    my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
-    my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
+    my_free(data);
+    my_free(pack_data);
   }
 
   // If only frm was changed continue replicating
@@ -3507,8 +3507,8 @@ ndb_binlog_thread_handle_data_event(Ndb 
 
   if (share->flags & NSF_BLOB_FLAG)
   {
-    my_free(blobs_buffer[0], MYF(MY_ALLOW_ZERO_PTR));
-    my_free(blobs_buffer[1], MYF(MY_ALLOW_ZERO_PTR));
+    my_free(blobs_buffer[0]);
+    my_free(blobs_buffer[1]);
   }
 
   return 0;
@@ -3580,7 +3580,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema
     ndb_schema_object->key_length= length;
     if (my_hash_insert(&ndb_schema_objects, (uchar*) ndb_schema_object))
     {
-      my_free((uchar*) ndb_schema_object, 0);
+      my_free(ndb_schema_object);
       break;
     }
     mysql_mutex_init(key_ndb_schema_object_mutex, &ndb_schema_object->mutex, MY_MUTEX_INIT_FAST);
@@ -3612,7 +3612,7 @@ static void ndb_free_schema_object(NDB_S
     DBUG_PRINT("info", ("use_count: %d", (*ndb_schema_object)->use_count));
     my_hash_delete(&ndb_schema_objects, (uchar*) *ndb_schema_object);
     mysql_mutex_destroy(&(*ndb_schema_object)->mutex);
-    my_free((uchar*) *ndb_schema_object, MYF(0));
+    my_free(*ndb_schema_object);
     *ndb_schema_object= 0;
   }
   else

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2010-06-17 13:31:51 +0000
+++ b/sql/ha_partition.cc	2010-07-08 21:20:08 +0000
@@ -287,7 +287,7 @@ ha_partition::~ha_partition()
     for (i= 0; i < m_tot_parts; i++)
       delete m_file[i];
   }
-  my_free((char*) m_ordered_rec_buffer, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(m_ordered_rec_buffer);
 
   clear_handler_file();
   DBUG_VOID_RETURN;
@@ -2267,7 +2267,7 @@ bool ha_partition::create_handler_file(c
   }
   else
     result= TRUE;
-  my_free((char*) file_buffer, MYF(0));
+  my_free(file_buffer);
   DBUG_RETURN(result);
 }
 
@@ -2285,8 +2285,8 @@ void ha_partition::clear_handler_file()
 {
   if (m_engine_array)
     plugin_unlock_list(NULL, m_engine_array, m_tot_parts);
-  my_free((char*) m_file_buffer, MYF(MY_ALLOW_ZERO_PTR));
-  my_free((char*) m_engine_array, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(m_file_buffer);
+  my_free(m_engine_array);
   m_file_buffer= NULL;
   m_engine_array= NULL;
 }
@@ -2495,7 +2495,7 @@ bool ha_partition::get_from_handler_file
 err3:
   my_afree((gptr) engine_array);
 err2:
-  my_free(file_buffer, MYF(0));
+  my_free(file_buffer);
 err1:
   (void) mysql_file_close(file, MYF(0));
   DBUG_RETURN(TRUE);

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2010-06-08 17:47:10 +0000
+++ b/sql/handler.cc	2010-07-08 21:20:08 +0000
@@ -392,7 +392,7 @@ static int ha_finish_errors(void)
   /* Allocate a pointer array for the error message strings. */
   if (! (errmsgs= my_error_unregister(HA_ERR_FIRST, HA_ERR_LAST)))
     return 1;
-  my_free((uchar*) errmsgs, MYF(0));
+  my_free(errmsgs);
   return 0;
 }
 
@@ -447,7 +447,7 @@ int ha_finalize_handlerton(st_plugin_int
     hton2plugin[hton->slot]= NULL;
   }
 
-  my_free((uchar*)hton, MYF(0));
+  my_free(hton);
 
  end:
   DBUG_RETURN(0);
@@ -580,7 +580,7 @@ err_deinit:
     (void) plugin->plugin->deinit(NULL);
           
 err:
-  my_free((uchar*) hton, MYF(0));
+  my_free(hton);
 err_no_hton_memory:
   plugin->data= NULL;
   DBUG_RETURN(1);
@@ -1630,7 +1630,7 @@ int ha_recover(HASH *commit_list)
   plugin_foreach(NULL, xarecover_handlerton, 
                  MYSQL_STORAGE_ENGINE_PLUGIN, &info);
 
-  my_free((uchar*)info.list, MYF(0));
+  my_free(info.list);
   if (info.found_foreign_xids)
     sql_print_warning("Found %d prepared XA transactions", 
                       info.found_foreign_xids);
@@ -3658,7 +3658,7 @@ int ha_create_table_from_engine(THD* thd
   build_table_filename(path, sizeof(path) - 1, db, name, "", 0);
   // Save the frm file
   error= writefrm(path, frmblob, frmlen);
-  my_free(frmblob, MYF(0));
+  my_free(frmblob);
   if (error)
     DBUG_RETURN(2);
 
@@ -4865,7 +4865,7 @@ int fl_log_iterator_next(struct handler_
 
 void fl_log_iterator_destroy(struct handler_iterator *iterator)
 {
-  my_free((uchar*)iterator->buffer, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(iterator->buffer);
 }
 
 

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2010-06-11 01:30:49 +0000
+++ b/sql/handler.h	2010-07-08 21:20:08 +0000
@@ -458,11 +458,7 @@ typedef struct xid_t XID;
 
 /* for recover() handlerton call */
 #define MIN_XID_LIST_SIZE  128
-#ifdef SAFEMALLOC
-#define MAX_XID_LIST_SIZE  256
-#else
 #define MAX_XID_LIST_SIZE  (1024*128)
-#endif
 
 /*
   These structures are used to pass information from a set of SQL commands

=== modified file 'sql/item.h'
--- a/sql/item.h	2010-06-02 12:23:50 +0000
+++ b/sql/item.h	2010-07-07 06:00:46 +0000
@@ -2791,6 +2791,7 @@ protected:  
     cached_field_type= item->field_type();
     cached_result_type= item->result_type();
     unsigned_flag= item->unsigned_flag;
+    fixed= item->fixed;
   }
 
 public:

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2010-06-25 15:32:59 +0000
+++ b/sql/item_func.cc	2010-07-08 21:20:08 +0000
@@ -3560,7 +3560,7 @@ public:
     {
       if (my_hash_insert(&hash_user_locks,(uchar*) this))
       {
-	my_free(key,MYF(0));
+	my_free(key);
 	key=0;
       }
     }
@@ -3570,7 +3570,7 @@ public:
     if (key)
     {
       my_hash_delete(&hash_user_locks,(uchar*) this);
-      my_free(key, MYF(0));
+      my_free(key);
     }
     mysql_cond_destroy(&cond);
   }
@@ -4079,7 +4079,7 @@ static user_var_entry *get_variable(HASH
     memcpy(entry->name.str, name.str, name.length+1);
     if (my_hash_insert(hash,(uchar*) entry))
     {
-      my_free((char*) entry,MYF(0));
+      my_free(entry);
       return 0;
     }
   }
@@ -4217,7 +4217,7 @@ update_hash(user_var_entry *entry, bool 
   {
     char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry));
     if (entry->value && entry->value != pos)
-      my_free(entry->value,MYF(0));
+      my_free(entry->value);
     entry->value= 0;
     entry->length= 0;
   }
@@ -4232,7 +4232,7 @@ update_hash(user_var_entry *entry, bool 
       if (entry->value != pos)
       {
 	if (entry->value)
-	  my_free(entry->value,MYF(0));
+	  my_free(entry->value);
 	entry->value=pos;
       }
     }

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2010-05-07 16:17:55 +0000
+++ b/sql/item_strfunc.cc	2010-07-09 05:39:41 +0000
@@ -72,7 +72,12 @@ String *Item_str_ascii_func::val_str(Str
   DBUG_ASSERT(fixed == 1);
 
   if (!(collation.collation->state & MY_CS_NONASCII))
-    return val_str_ascii(str);
+  {
+    String *res= val_str_ascii(str);
+    if (res)
+      res->set_charset(collation.collation);
+    return res;
+  }
   
   DBUG_ASSERT(str != &ascii_buf);
   
@@ -242,7 +247,7 @@ void Item_func_sha::fix_length_and_dec()
   fix_length_and_charset(SHA1_HASH_SIZE * 2, default_charset());
 }
 
-String *Item_func_sha2::val_str(String *str)
+String *Item_func_sha2::val_str_ascii(String *str)
 {
   DBUG_ASSERT(fixed == 1);
 #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
@@ -338,19 +343,19 @@ void Item_func_sha2::fix_length_and_dec(
   switch (sha_variant) {
 #ifndef OPENSSL_NO_SHA512
   case 512:
-    max_length= SHA512_DIGEST_LENGTH*2;
+    fix_length_and_charset(SHA512_DIGEST_LENGTH * 2, default_charset());
     break;
   case 384:
-    max_length= SHA384_DIGEST_LENGTH*2;
+    fix_length_and_charset(SHA384_DIGEST_LENGTH * 2, default_charset());
     break;
 #endif
 #ifndef OPENSSL_NO_SHA256
   case 256:
   case 0: // SHA-256 is the default
-    max_length= SHA256_DIGEST_LENGTH*2;
+    fix_length_and_charset(SHA256_DIGEST_LENGTH * 2, default_charset());
     break;
   case 224:
-    max_length= SHA224_DIGEST_LENGTH*2;
+    fix_length_and_charset(SHA224_DIGEST_LENGTH * 2, default_charset());
     break;
 #endif
   default:

=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h	2010-04-27 09:58:21 +0000
+++ b/sql/item_strfunc.h	2010-07-07 06:38:11 +0000
@@ -82,16 +82,13 @@ public:
   const char *func_name() const { return "sha"; }	
 };
 
-class Item_func_sha2 :public Item_str_func
+class Item_func_sha2 :public Item_str_ascii_func
 {
 public:
-  Item_func_sha2(Item *a, Item *b) :Item_str_func(a, b)
-  {
-    collation.set(&my_charset_bin);
-  }
-  String *val_str(String *);    
-  void fix_length_and_dec();      
-  const char *func_name() const { return "sha2"; }	
+  Item_func_sha2(Item *a, Item *b) :Item_str_ascii_func(a, b) {}
+  String *val_str_ascii(String *);
+  void fix_length_and_dec();
+  const char *func_name() const { return "sha2"; }
 };
 
 class Item_func_aes_encrypt :public Item_str_func

=== modified file 'sql/keycaches.cc'
--- a/sql/keycaches.cc	2009-12-22 09:35:56 +0000
+++ b/sql/keycaches.cc	2010-07-08 21:20:08 +0000
@@ -44,7 +44,7 @@ public:
   }
   ~NAMED_ILINK()
   {
-    my_free((uchar*) name, MYF(0));
+    my_free((void *) name);
   }
 };
 
@@ -104,7 +104,7 @@ KEY_CACHE *create_key_cache(const char *
   {
     if (!new NAMED_ILINK(&key_caches, name, length, (uchar*) key_cache))
     {
-      my_free((char*) key_cache, MYF(0));
+      my_free(key_cache);
       key_cache= 0;
     }
     else
@@ -140,7 +140,7 @@ KEY_CACHE *get_or_create_key_cache(const
 void free_key_cache(const char *name, KEY_CACHE *key_cache)
 {
   end_key_cache(key_cache, 1);		// Can never fail
-  my_free((char*) key_cache, MYF(0));
+  my_free(key_cache);
 }
 
 

=== modified file 'sql/lock.cc'
--- a/sql/lock.cc	2010-07-01 13:53:46 +0000
+++ b/sql/lock.cc	2010-07-13 08:39:24 +0000
@@ -262,7 +262,7 @@ static void reset_lock_data(MYSQL_LOCK *
 static void reset_lock_data_and_free(MYSQL_LOCK **mysql_lock)
 {
   reset_lock_data(*mysql_lock);
-  my_free(*mysql_lock, MYF(0));
+  my_free(*mysql_lock);
   *mysql_lock= 0;
 }
 
@@ -384,7 +384,7 @@ void mysql_unlock_tables(THD *thd, MYSQL
     thr_multi_unlock(sql_lock->locks,sql_lock->lock_count);
   if (sql_lock->table_count)
     (void) unlock_external(thd,sql_lock->table,sql_lock->table_count);
-  my_free((uchar*) sql_lock,MYF(0));
+  my_free(sql_lock);
   DBUG_VOID_RETURN;
 }
 
@@ -545,7 +545,7 @@ void mysql_lock_abort(THD *thd, TABLE *t
   {
     for (uint i=0; i < locked->lock_count; i++)
       thr_abort_locks(locked->locks[i]->lock, upgrade_lock);
-    my_free((uchar*) locked,MYF(0));
+    my_free(locked);
   }
   DBUG_VOID_RETURN;
 }
@@ -577,7 +577,7 @@ bool mysql_lock_abort_for_thread(THD *th
                                      table->in_use->thread_id))
         result= TRUE;
     }
-    my_free((uchar*) locked,MYF(0));
+    my_free(locked);
   }
   DBUG_RETURN(result);
 }
@@ -619,8 +619,8 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK 
   }
 
   /* Delete old, not needed locks */
-  my_free((uchar*) a,MYF(0