• Alexander Barkov's avatar
    MDEV-21695 Server crashes in TABLE::evaluate_update_default_function upon UPDATE on temporary table · b46b7144
    Alexander Barkov authored
    copy_data_between_tables() sets to->s->default_fields to 0, as a part
    of the code disabling ON UPDATE actions for all old fields
    (so ON UPDATE is enable only for new fields during copying).
    After the actual copying, copy_data_between_tables() did not restore
    to->s->default_fields to the original value. As a result, the
    TABLE_SHARE to->s was left in a wrong state after copy_data_between_tables()
    and further open_table_from_share() using this TABLE_SHARE did not
    populate TABLE::default_field, which further made
    TABLE::evaluate_update_default_function() crash on access to NULL
    pointer.
    
    Fix:
    Changing copy_data_between_tables() to restore to->s->default_fields
    to its original value after the copying loop.
    b46b7144
temp_table.result 15.4 KB