• unknown's avatar
    Bug#28729: Field_enum wrongly reported an error while storing an empty string. · a7cf92bb
    unknown authored
    ENUM fields internally store their values as integers and may use integer
    values as indexes to their values. Invalid values are mapped to zero value.
    When storing an empty string the ENUM field fails to find an appropriate value
    and tries to convert the provided string to integer. The conversion also
    fails and error is returned even if the thd->count_cuted_fields is set to
    CHECK_FIELD_IGNORE. This makes the range optimizer wrongly decide that an
    impossible range is present.
    
    Now the Field_enum::store() returns error while storing an empty string only
    if the thd->count_cuted_fields isn't set to CHECK_FIELD_IGNORE.
    
    
    sql/field.cc:
      Bug#28729: Field_enum wrongly reported an error while storing an empty string.
      Now the Field_enum::store() returns error while storing an empty string only
      if the thd->count_cuted_fields isn't set to CHECK_FIELD_IGNORE.
    mysql-test/r/type_enum.result:
      Added a test case for the bug#28729: Field_enum wrongly reported an error
      while storing an empty string.
    mysql-test/t/type_enum.test:
      Added a test case for the bug#28729: Field_enum wrongly reported an error
      while storing an empty string.
    a7cf92bb
field.cc 249 KB