diff --git a/mysql-test/r/droptable_encoding.result b/mysql-test/r/droptable_encoding.result new file mode 100644 index 0000000..50ba13a --- /dev/null +++ b/mysql-test/r/droptable_encoding.result @@ -0,0 +1,44 @@ +include/master-slave.inc +[connection master] +create table `drop_tablé_test`(a int) engine=MyISAM; +create table `drop_tablé_test2`(a int) engine=InnoDB; +set default_tmp_storage_engine=MyISAM; +create temporary table `drop_tablé_test3`(a int); +set default_tmp_storage_engine=InnoDB; +create temporary table `drop_tablé_test4`(a int); +create table `drop_tablé_test5`(a int) engine=MyISAM; +create table `drop_tablé_test6`(a int) engine=InnoDB; +set default_tmp_storage_engine=MyISAM; +create temporary table `drop_tablé_test7`(a int); +set default_tmp_storage_engine=InnoDB; +create temporary table `drop_tablé_test8`(a int); +drop table `drop_tablé_test`; +drop table `drop_tablé_test2`; +drop temporary table `drop_tablé_test3`; +drop temporary table `drop_tablé_test4`; +drop table if exists `drop_tablé_test5`; +drop table if exists `drop_tablé_test6`; +drop temporary table if exists `drop_tablé_test7`; +drop temporary table if exists `drop_tablé_test8`; +drop temporary table if exists `drop_tablé_test9`; +show binlog events; +Log_name Pos Event_type Server_id End_log_pos Info +# # # # # +# # # # # use `test`; create table `drop_tablé_test`(a int) engine=MyISAM +# # # # # use `test`; create table `drop_tablé_test2`(a int) engine=InnoDB +# # # # # use `test`; create temporary table `drop_tablé_test3`(a int) +# # # # # use `test`; create temporary table `drop_tablé_test4`(a int) +# # # # # use `test`; create table `drop_tablé_test5`(a int) engine=MyISAM +# # # # # use `test`; create table `drop_tablé_test6`(a int) engine=InnoDB +# # # # # use `test`; create temporary table `drop_tablé_test7`(a int) +# # # # # use `test`; create temporary table `drop_tablé_test8`(a int) +# # # # # use `test`; DROP TABLE `drop_tablé_test` /* generated by server */ +# # # # # use `test`; DROP TABLE `drop_tablé_test2` /* generated by server */ +# # # # # use `test`; DROP TEMPORARY TABLE `drop_tablé_test3` /* generated by server */ +# # # # # use `test`; DROP TEMPORARY TABLE `drop_tablé_test4` /* generated by server */ +# # # # # use `test`; DROP TABLE IF EXISTS `drop_tablé_test5` /* generated by server */ +# # # # # use `test`; DROP TABLE IF EXISTS `drop_tablé_test6` /* generated by server */ +# # # # # DROP TEMPORARY TABLE IF EXISTS `test`.`drop_tablé_test7` /* generated by server */ +# # # # # DROP TEMPORARY TABLE IF EXISTS `test`.`drop_tablé_test8` /* generated by server */ +# # # # # DROP TEMPORARY TABLE IF EXISTS `test`.`drop_tablé_test9` /* generated by server */ +include/rpl_end.inc diff --git a/mysql-test/t/droptable_encoding.test b/mysql-test/t/droptable_encoding.test new file mode 100644 index 0000000..191bd2f --- /dev/null +++ b/mysql-test/t/droptable_encoding.test @@ -0,0 +1,55 @@ +############################################################################## +# Test the droptable binlog encoding fix +############################################################################## + +--disable_warnings +--source include/master-slave.inc +--enable_warnings + +--connection master + +create table `drop_tablé_test`(a int) engine=MyISAM; +create table `drop_tablé_test2`(a int) engine=InnoDB; + +set default_tmp_storage_engine=MyISAM; +create temporary table `drop_tablé_test3`(a int); +set default_tmp_storage_engine=InnoDB; +create temporary table `drop_tablé_test4`(a int); + +create table `drop_tablé_test5`(a int) engine=MyISAM; +create table `drop_tablé_test6`(a int) engine=InnoDB; + +set default_tmp_storage_engine=MyISAM; +create temporary table `drop_tablé_test7`(a int); +set default_tmp_storage_engine=InnoDB; +create temporary table `drop_tablé_test8`(a int); + +sync_slave_with_master; + +--connection master + +# Non-temp table +drop table `drop_tablé_test`; +drop table `drop_tablé_test2`; +# Non-trans temp table +drop temporary table `drop_tablé_test3`; +# Trans temp table +drop temporary table `drop_tablé_test4`; +# Non-trans temp table -- if exists +drop table if exists `drop_tablé_test5`; +# Trans temp table -- if exists +drop table if exists `drop_tablé_test6`; +# Non-temp table -- if exists +drop temporary table if exists `drop_tablé_test7`; +drop temporary table if exists `drop_tablé_test8`; +# Non-existing temp table +--disable_warnings +drop temporary table if exists `drop_tablé_test9`; +--enable_warnings + +--replace_column 1 # 2 # 3 # 4 # 5 # +--replace_regex /Server ver.*// /.*-fb-.*// /Binlog ver.*// + +show binlog events; + +--source include/rpl_end.inc diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5f5f782..92375b9 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2303,7 +2303,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, { if (!drop_temporary) { - built_query.set_charset(system_charset_info); + built_query.set_charset(thd->charset()); if (if_exists) built_query.append("DROP TABLE IF EXISTS "); else @@ -2313,19 +2313,19 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, if (thd->is_current_stmt_binlog_format_row() || if_exists) { is_drop_tmp_if_exists_added= true; - built_trans_tmp_query.set_charset(system_charset_info); + built_trans_tmp_query.set_charset(thd->charset()); built_trans_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS "); - built_non_trans_tmp_query.set_charset(system_charset_info); + built_non_trans_tmp_query.set_charset(thd->charset()); built_non_trans_tmp_query.append("DROP TEMPORARY TABLE IF EXISTS "); } else { - built_trans_tmp_query.set_charset(system_charset_info); + built_trans_tmp_query.set_charset(thd->charset()); built_trans_tmp_query.append("DROP TEMPORARY TABLE "); - built_non_trans_tmp_query.set_charset(system_charset_info); + built_non_trans_tmp_query.set_charset(thd->charset()); built_non_trans_tmp_query.append("DROP TEMPORARY TABLE "); } - nonexistent_tmp_tables.set_charset(system_charset_info); + nonexistent_tmp_tables.set_charset(thd->charset()); } for (table= tables; table; table= table->next_local)