• Nikita Malyavin's avatar
    MDEV-31631 Adding auto-increment to table with history online misbehaves · 44ca37ef
    Nikita Malyavin authored
    Adding an auto_increment column online leads to an undefined behavior.
    Basically any DEFAULTs that depend on a row order in the table, or on
    the non-deterministic (in scope of the ALTER TABLE statement) function
    is UB.
    
    For example, NOW() is considered generally non-deterministic
    (Item_func_now_utc is marked with VCOL_NON_DETERMINISTIC), but it's fixed
    in scope of a single statement.
    
    Same for any other function that depends only on the session/status vars
    apart from its arguments.
    
    Only two UB cases are known:
    * adding new AUTO_INCREMENT column. Modifying the existing column may be
    fine under certain circumstances, see MDEV-31058.
    * adding new column with DEFAULT(nextval(...)). Modifying the existing
    column is possible, since its value will be always present in the online
    event, except for the NULL -> NOT NULL modification
    44ca37ef
alter_table_online_debug.result 38.6 KB