• unknown's avatar
    BUG#45574 CREATE IF NOT EXISTS is not binlogged if the object exists · fce4fa36
    unknown authored
    There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
    CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
    binlogged even if either the DB, TABLE or EVENT does not exist. In
    contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
    exists.  
    
    This patch fixes the following cases for all the replication formats:
    CREATE DATABASE IF NOT EXISTS.
    CREATE TABLE IF NOT EXISTS,
    CREATE TABLE IF NOT EXISTS ... LIKE,
    CREAET TABLE IF NOT EXISTS ... SELECT.
    
    sql/sql_insert.cc:
      Part of the code was moved from the create_table_from_items to select_create::prepare.
      When replication is row based, CREATE TABLE IF NOT EXISTS.. SELECT is binlogged if the table exists.
    fce4fa36
rpl_create_if_not_exists.test 2.16 KB