• Tatiana A. Nurnberg's avatar
    Bug#43508: Renaming timestamp or date column triggers table copy · 798ce983
    Tatiana A. Nurnberg authored
    We set up DATE and TIMESTAMP differently in field-creation than we
    did in field-MD creation (for CREATE). Admirably, ALTER TABLE
    detected this and didn't damage any data, but it did initiate a
    full copy/conversion, which we don't really need to do.
    
    Now we describe Field and Create_field the same for those types.
    As a result, ALTER TABLE that only changes meta-data (like a
    field's name) no longer forces a data-copy when there needn't
    be one.
    
    
    mysql-test/r/alter_table.result:
      0 rows should be affected when a meta-data change is enough ALTER TABLE.
    mysql-test/t/alter_table.test:
      add test-case: show that we don't do a full data-copy on ALTER TABLE
      when we don't need to.
    sql/field.cc:
      Remove Field_str::compare_str_field_flags() (now in Field/Create_field as
      field_flags_are_binary().
      
      Correct some field-lengths!
    sql/field.h:
      Clean-up: use defined constants rather than numeric literals for certain
      field-lengths.
      
      Add enquiry-functions binaryp() to classes Field and Create_field.
      This replaces field.cc's Field_str::compare_str_field_flags().
    798ce983
alter_table.test 26.5 KB