• unknown's avatar
    Fixed bug#12185: Data type aggregation may produce wrong result · 35209c68
    unknown authored
    The Item::tmp_table_field_from_field_type() function creates Field_datetime
    object instead of Field_timestamp object for timestamp field thus always
    changing data type is a tmp table is used.
    
    The Field_blob object constructor which is used in the 
    Item::tmp_table_field_from_field_type() is always setting packlength field of
    newly created blob to 4. This leads to changing fields data type for example
    from the blob to the longblob if a temporary table is used.
    
    The Item::make_string_field() function always converts Field_string objects 
    to Field_varstring objects. This leads to changing data type from the 
    char/binary to varchar/varbinary.
    
    Added appropriate Field_timestamp object constructor for using in the 
    Item::tmp_table_field_from_field_type() function.
    
    Added Field_blob object constructor which sets pack length according to
    max_length argument.
    
    The Item::tmp_table_field_from_field_type() function now creates
    Field_timestamp object for a timestamp field.
    
    The Item_type_holder::display_length() now returns correct NULL length NULL
    length. 
    
    The Item::make_string_field() function now doesn't change Field_string to
    Field_varstring in the case of Item_type_holder. 
    
    The Item::tmp_table_field_from_field_type() function now uses the Field_blob
    constructor which sets packlength according to max_length.
    
    
    mysql-test/t/union.test:
      Added test case for bug#12185: Data type aggregation may produce wrong result
      Corrected test case after fix for bug#12185
    mysql-test/t/innodb.test:
      Corrected test case after fix for bug#12185
    mysql-test/r/union.result:
      Added test case for bug#12185: Data type aggregation may produce wrong result
       Corrected test case after fix for bug#12185
    mysql-test/r/innodb.result:
      Corrected test case after fix for bug#12185
    mysql-test/r/create.result:
      Corrected the test case after fixing bug#12185
    sql/field.h:
      Fixed bug#12185: Data type aggregation may produce wrong result
      Added Field_blob object constructor which sets packlength according to
      max_length argument.
    sql/item.cc:
      Fixed bug#12185: Data type aggregation may produce wrong result
      The Item::make_string_field() function now doesn't change Field_string to
      Field_varstring in the case of Item_type_holder.
      The Item::tmp_table_field_from_field_type() function now creates
      Field_timestamp object for a timestamp field.
      The Item::tmp_table_field_from_field_type() function now uses the Field_blob
      constructor which sets packlength according to max_length.
      The Item_type_holder::display_length() now returns correct NULL length NULL
      length.
    sql/field.cc:
      Fixed bug#12185: Data type aggregation may produce wrong result
      Added appropriate Field_timestamp object constructor for using in the 
      Item::tmp_table_field_from_field_type() function.
    35209c68
innodb.test 70.4 KB