diff options
author | unknown <Dao-Gang.Qu@sun.com> | 2010-12-29 13:22:52 +0800 |
---|---|---|
committer | unknown <Dao-Gang.Qu@sun.com> | 2010-12-29 13:22:52 +0800 |
commit | 7f6ce96df7188513bf3b502270aa2d8df1d2168e (patch) | |
tree | cb67b7a964821370a414aeae47472a4c25b57b47 /mysql-test/r/mysqlbinlog.result | |
parent | be6c3fd8aa3f99074ae9d8ac729062585544b3b8 (diff) | |
parent | 22639a066cde7b18133f81ca8c0528e115c08677 (diff) | |
download | mariadb-git-7f6ce96df7188513bf3b502270aa2d8df1d2168e.tar.gz |
Bug #50914 mysqlbinlog not handling drop of current default database
mysqlbinlog only prints "use $database" statements to its output stream
when the active default database changes between events. This will cause
"No Database Selected" error when dropping and recreating that database.
To fix the problem, we clear print_event_info->db when printing an event
of CREATE/DROP/ALTER database statements, so that the Query_log_event
after such statements will be printed with the use 'db' anyway except
transaction keywords.
mysql-test/r/mysqlbinlog.result:
Test result for Bug#50914.
mysql-test/t/mysqlbinlog.test:
Added test to verify if the approach of the mysqlbinlog prints
"use $database" statements to its output stream will cause
"No Database Selected" error when dropping and recreating
that database.
sql/log_event.cc:
Updated code to clear print_event_info->db when printing an event
of CREATE/DROP/ALTER database statements, so that the Query_log_event
after such statements will be printed with the use 'db' anyway except
transaction keywords.
Diffstat (limited to 'mysql-test/r/mysqlbinlog.result')
-rw-r--r-- | mysql-test/r/mysqlbinlog.result | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index ce83fe5b79b..0b9f6db05b8 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -883,3 +883,23 @@ End of 5.1 tests WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead. # Expect deprecation warning again. WARNING: The --base64-output=always flag and the --base64-output flag (with '=MODE' omitted), are deprecated. The output generated when these flags are used cannot be parsed by mysql 5.6.0 and later. The flags will be removed in a future version. Please use --base64-output=auto instead. +RESET MASTER; +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1(id int); +DROP DATABASE test1; +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1(id int); +DROP TABLE t1; +DROP DATABASE test1; +FLUSH LOGS; +show binlog events in 'master-bin.000002' from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Query # # CREATE DATABASE test1 +master-bin.000002 # Query # # use `test1`; CREATE TABLE t1(id int) +master-bin.000002 # Query # # DROP DATABASE test1 +master-bin.000002 # Query # # CREATE DATABASE test1 +master-bin.000002 # Query # # use `test1`; CREATE TABLE t1(id int) +master-bin.000002 # Query # # use `test1`; DROP TABLE `t1` /* generated by server */ +master-bin.000002 # Query # # DROP DATABASE test1 |