• evgen@sunlight.local's avatar
    Bug#27216: functions with parameters of different date types may return wrong · 36bf417b
    evgen@sunlight.local authored
    type of the result.
    
    There are several functions that accept parameters of different types.
    The result field type of such functions was determined based on
    the aggregated result type of its arguments. As the DATE and the DATETIME
    types are represented by the STRING type, the result field type
    of the affected functions was always STRING for DATE/DATETIME arguments.
    The affected functions are COALESCE, IF, IFNULL, CASE, LEAST/GREATEST, CASE.
    
    Now the affected functions aggregate the field types of their arguments rather
    than their result types and return the result of aggregation as their result
    field type.
    The cached_field_type member variable is added to the number of classes to
    hold the aggregated result field type.
    The str_to_date() function's result field type now defaults to the
    MYSQL_TYPE_DATETIME.
    The agg_field_type() function is added. It aggregates field types with help
    of the Field::field_type_merge() function.
    The create_table_from_items() function now uses the 
    item->tmp_table_field_from_field_type() function to get the proper field
    when the item is a function with a STRING result type.
    36bf417b
protocol.cc 32.3 KB