• unknown's avatar
    Bug #50914 mysqlbinlog not handling drop of current default database · 7f6ce96d
    unknown authored
          
    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.
    7f6ce96d
mysqlbinlog.result 28.1 KB