• evgen@moonbone.local's avatar
    Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function · 0e3c4f67
    evgen@moonbone.local authored
    is involved.
    
    The Arg_comparator::compare_datetime() comparator caches its arguments if
    they are constants i.e. const_item() returns true. The
    Item_func_get_user_var::const_item() returns true or false based on
    the current query_id and the query_id where the variable was created.
    Thus even if a query can change its value its const_item() still will return
    true. All this leads to a wrong comparison result when an object of the
    Item_func_get_user_var class is involved.
    
    Now the Arg_comparator::can_compare_as_dates() and the
    get_datetime_value() functions never cache result of the GET_USER_VAR()
    function (the Item_func_get_user_var class).
    0e3c4f67
item_cmpfunc.cc 121 KB