• Mats Kindahl's avatar
    Bug #34707: Row based replication: slave creates table within wrong database · f0bf4a47
    Mats Kindahl authored
    The failure was caused by executing a CREATE-SELECT statement that creates a
    table in another database than the current one. In row-based logging, the
    CREATE statement was written to the binary log without the database, hence
    creating the table in the wrong database, causing the following inserts to
    fail since the table didn't exist in the given database.
    
    Fixed the bug by adding a parameter to store_create_info() that will make
    the function print the database name before the table name and used that
    in the calls that write the CREATE statement to the binary log. The database
    name is only printed if it is different than the currently selected database.
    
    The output of SHOW CREATE TABLE has not changed and is still printed without
    the database name.
    f0bf4a47
sql_insert.cc 122 KB