diff options
author | unknown <igor@olga.mysql.com> | 2007-05-15 14:14:52 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-05-15 14:14:52 -0700 |
commit | 83504b0d81eb33e966bdae670ada2172ced8df0e (patch) | |
tree | ca5ea68c661900660a1a67ed0fb6c7958a614a3a | |
parent | d9f910ee8ef3647dc88f3cec9d7e80101734ffaf (diff) | |
parent | d68be9ba66086b81ce0afff3f5938867b0676dd2 (diff) | |
download | mariadb-git-83504b0d81eb33e966bdae670ada2172ced8df0e.tar.gz |
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug28272
-rw-r--r-- | mysql-test/r/type_datetime.result | 6 | ||||
-rw-r--r-- | mysql-test/t/type_datetime.test | 9 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 5 |
3 files changed, 17 insertions, 3 deletions
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index b45ddd597c4..573139bed48 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -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; diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index c111f2f02cf..4c2416000be 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -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; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 4f0347dd506..9a251312aca 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -661,7 +661,7 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg, Item_result type) { enum enum_date_cmp_type cmp_type; - ulonglong const_value; + ulonglong const_value= (ulonglong)-1; a= a1; b= a2; @@ -674,8 +674,7 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg, a_cache= 0; b_cache= 0; - if (cmp_type != CMP_DATE_WITH_DATE && - ((*b)->const_item() || (*a)->const_item())) + if (const_value != (ulonglong)-1) { Item_cache_int *cache= new Item_cache_int(); /* Mark the cache as non-const to prevent re-caching. */ |