-
unknown 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). mysql-test/t/type_datetime.test: A test case is added for the bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function is involved. mysql-test/r/type_datetime.result: A test case is added for the bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function is involved. sql/item_cmpfunc.cc: Bug#28261: Wrong DATETIME comparison result when the GET_USER_VAR function 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).
c4a4df5a