• Martin Hansson's avatar
    Bug#47925: regression of range optimizer and date comparison in 5.1.39! · 4f79bd5d
    Martin Hansson authored
    When a query was using a DATE or DATETIME value formatted
    using any other separator characters beside hyphen '-', a
    query with a greater-or-equal '>=' condition matching only
    the greatest value in an indexed column, the result was
    empty if index range scan was employed.
    
    The range optimizer got a new feature between 5.1.38 and
    5.1.39 that changes a greater-or-equal condition to a
    greater-than if the value matching that in the query was not
    present in the table. But the value comparison function
    compared the dates as strings instead of dates.
    
    The bug was fixed by splitting the function
    get_date_from_str in two: One part that parses and does
    error checking. This function is now visible outside the
    module. The old get_date_from_str now calls the new
    function.
    
    
    mysql-test/r/range.result:
      Bug#47925: Test result
    mysql-test/t/range.test:
      Bug#47925: Test case
    sql/item.cc:
      Bug#47925: Fix + some edit on the comments
    sql/item.h:
      Bug#47925: Changed function signature
    sql/item_cmpfunc.cc:
      Bug#47925: Split function in two
    sql/item_cmpfunc.h:
      Bug#47925: Declaration of new function
    sql/opt_range.cc:
      Bug#47925: Added THD to function call
    sql/time.cc:
      Bug#47925: Added microsecond comparison
    4f79bd5d
range.result 55.9 KB