• evgen@moonbone.local's avatar
    Bug#28427: Columns were renamed instead of moving by ALTER TABLE. · fc01b099
    evgen@moonbone.local authored
    To avoid unnecessary work the mysql_alter_table function takes the
    list of table fields and applies all changes to it (drops/moves/renames/etc).
    Then this function compares the new list and the old one. If the changes
    require only .frm to be modified then the actual data isn't copied. To detect
    changes all columns attributes but names are compared. When a column has been
    moved and has replaced another column with the same attributes except name
    the mysql_alter_table function wrongly decides that two fields has been just
    renamed. As a result the data from the moved column and from all columns
    after it is not copied.
    
    Now the mysql_alter_table function forces table data copying by setting
    the need_copy_table flag when it finds a moved column. The flag is set at
    the stage when the modified fields are created.
    fc01b099
sql_table.cc 225 KB