• Monty's avatar
    Check if we can rename triggers before doing an ALTER TABLE ... RENAME · 3c578b0a
    Monty authored
    ALTER TABLE .. RENAME, when used with the inplace algorithm, does:
    - Do an inplace or online alter to the new definition
    - Rename to new name
    - Update triggers.
    
    If update triggers would fail, we would rename the table back.
    The problem with this approach is that the table would have the new
    definition but the rename would fail.  The binary log would also not be
    updated.
    
    The solution to this is to very early check if we can rename triggers
    and give an error if this would fail.
    Both ALTER TABLE ... RENAME and RENAME TABLE is fixed.
    
    This was implemented by moving the pre-check of rename table in triggers
    from Table_triggers_list::change_table_name() to
    Table_triggers_list::prepare_for_rename().
    3c578b0a
sql_table.cc 380 KB