• unknown's avatar
    Bug#27670: LOAD DATA does not set CURRENT_TIMESTAMP default value for a · dcede16e
    unknown authored
    TIMESTAMP field when no value has been provided.
    
    The LOAD DATA sets the current time in the TIMESTAMP field with
    CURRENT_TIMESTAMP default value when the field is detected as a null.
    But when the LOAD DATA command loads data from a file that doesn't contain
    enough data for all fields then the rest of fields are simply set to null
    without any check. This leads to no value being inserted to such TIMESTAMP
    field.
    
    Now the read_sep_field() and the read_fixed_length() functions set current
    time to the TIMESTAMP field with CURRENT_TIMESTAMP default value in all cases
    when a NULL value is loaded to the field.
    
    
    mysql-test/t/loaddata.test:
      Added a test case for the bug#27670: LOAD DATA does not set CURRENT_TIMESTAMP
      default value for a TIMESTAMP field when no value has been provided.
    mysql-test/r/loaddata.result:
      Added a test case for the bug#27670: LOAD DATA does not set CURRENT_TIMESTAMP
      default value for a TIMESTAMP field when no value has been provided.
    sql/sql_load.cc:
      Bug#27670: LOAD DATA does not set CURRENT_TIMESTAMP default value for a
      TIMESTAMP field when no value has been provided.
      Now the read_sep_field() and the read_fixed_length() functions set current
      time to the TIMESTAMP field with CURRENT_TIMESTAMP default value in all cases
      when a NULL value is loaded to the field.
    dcede16e
loaddata.test 6.26 KB