• Sergei Golubchik's avatar
    MDEV-5406 add index to an innodb table with a uniqueness violation crashes mysqld · 2ff76f67
    Sergei Golubchik authored
    After table->file->add_index() in mysql_alter_table() the table in the engine
    has the intermediate temporary structure, it's neither the original nor the
    final table structure (it'll be final after successful table->file->drop_index()
    call). So, when add_index() fails with a unique key violation, we cannot simply
    get the failed key number and easily map it to the key name and key structure via
    table->key_info[key_no].
    
    For now we'll create this "intermediate temporary structure", emulating InnoDB
    internal rules.
    
    This bug and the fix will go away in 10.0 that uses completely different online
    alter table code.
    
    mysql-test/t/alter_table_trans.test:
      mdev:5406
    2ff76f67
sql_table.cc 254 KB