• Davi Arnaut's avatar
    Bug#45567: Fast ALTER TABLE broken for enum and set · 8d3d35ea
    Davi Arnaut authored
    The problem was that appending values to the end of an existing
    ENUM or SET column was being treated as table data modification,
    preventing a immediately (fast) table alteration that occurs when
    only table metadata is being modified.
    
    The cause was twofold: adding a enumeration or set members to the 
    end of the list of valid member values was not being considered
    a "compatible" table alteration, and for SET columns, the check
    was being done upon the max display length and not the underlying
    (pack) length of the field.
    
    The solution is to augment the function that checks wether two ENUM
    or SET fields are compatible -- by comparing the pack lengths and
    performing a limited comparison of the member values.
    
    mysql-test/r/alter_table.result:
      Add test case result for Bug#45567
    mysql-test/t/alter_table.test:
      Add test case for Bug#45567
    sql/field.cc:
      Check whether two fields can be considered 'equal' for table
      alteration purposes. Fields are equal if they retain the same
      pack length and if new members are added to the end of the list.
    sql/field.h:
      Add comment and remove method.
    8d3d35ea
field.cc 290 KB