mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#28208: Wrong result of a non-const STRING function with a const DATETIME
function. A wrong condition was used to check that the Arg_comparator::can_compare_as_dates() function calculated the value of the string constant. When comparing a non-const STRING function with a constant DATETIME function it leads to saving an arbitrary value as a cached value of the DATETIME function. Now the Arg_comparator::set_cmp_func() function initializes the const_value variable to the impossible DATETIME value (-1) and this const_value is cached only if it was changed by the Arg_comparator::can_compare_as_dates() function. mysql-test/t/type_datetime.test: Added a test case for the bug#28208: Wrong result of a non-const STRING function with a const DATETIME function. mysql-test/r/type_datetime.result: Added a test case for the bug#28208: Wrong result of a non-const STRING function with a const DATETIME function. sql/item_cmpfunc.cc: Bug#28208: Wrong result of a non-const STRING function with a const DATETIME function. Now the Arg_comparator::set_cmp_func() function initializes the const_value variable to the impossible DATETIME value (-1) and this const_value is cached only if it was changed by the Arg_comparator::can_compare_as_dates() function.
This commit is contained in:
@ -346,3 +346,9 @@ call test27759();
|
||||
a b a_then_b b_then_a c_then_a
|
||||
2007-04-10 2007-04-11 2007-04-10 2007-04-10 2004-04-09 00:00:00
|
||||
drop procedure test27759;
|
||||
create table t1 (f1 date);
|
||||
insert into t1 values (curdate());
|
||||
select left(f1,10) = curdate() from t1;
|
||||
left(f1,10) = curdate()
|
||||
1
|
||||
drop table t1;
|
||||
|
@ -225,3 +225,12 @@ END;|
|
||||
DELIMITER ;|
|
||||
call test27759();
|
||||
drop procedure test27759;
|
||||
|
||||
#
|
||||
# Bug#28208: Wrong result of a non-const STRING function with a const
|
||||
# DATETIME function.
|
||||
#
|
||||
create table t1 (f1 date);
|
||||
insert into t1 values (curdate());
|
||||
select left(f1,10) = curdate() from t1;
|
||||
drop table t1;
|
||||
|
Reference in New Issue
Block a user