• evgen@moonbone.local's avatar
    Bug#27759: Wrong DATE/DATETIME comparison in LEAST()/GREATEST() functions. · 239f727b
    evgen@moonbone.local authored
    The LEAST/GREATEST functions compared DATE/DATETIME values as
    strings which in some cases could lead to a wrong result.
    
    A new member function called cmp_datetimes() is added to the
    Item_func_min_max class. It compares arguments in DATETIME context
    and returns index of the least/greatest argument.
    The Item_func_min_max::fix_length_and_dec() function now detects when
    arguments should be compared in DATETIME context and sets the newly
    added flag compare_as_dates. It indicates that the cmp_datetimes() function
    should be called to get a correct result.
    Item_func_min_max::val_xxx() methods are corrected to call the
    cmp_datetimes() function when needed.
    Objects of the Item_splocal class now stores and reports correct original
    field type.
    239f727b
item_func.h 41 KB