• Alfranio Correia's avatar
    BUG#46861 Auto-closing of temporary tables broken by replicate-rewrite-db · ea06bbd2
    Alfranio Correia authored
    When a connection is dropped any remaining temporary table is also automatically
    dropped and the SQL statement of this operation is written to the binary log in
    order to drop such tables on the slave and keep the slave in sync. Specifically,
    the current code base creates the following type of statement:
    DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `db`.`table`;
    
    Unfortunately, appending the database to the table name in this manner circumvents
    the replicate-rewrite-db option (and any options that check the current database).
    To solve the issue, we started writing the statement to the binary as follows:
    use `db`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `table`;
    ea06bbd2
sql_base.cc 197 KB