diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-03-18 19:29:52 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-03-18 19:29:52 +0100 |
commit | c629477981cc491a12c3664b81f9fb33db00e481 (patch) | |
tree | ea11a0bd7790b8f24382f7bd8c4608d1f2c099e2 | |
parent | 5122e43a935a75a232b08b39e14b01e892bebb7e (diff) | |
download | mariadb-git-c629477981cc491a12c3664b81f9fb33db00e481.tar.gz |
lp:737474 Wrong result with DAY(COALESCE(NULL)) in 5.1-micro
fix the return value of Item_func_coalesce::get_date()
-rw-r--r-- | mysql-test/r/func_time.result | 3 | ||||
-rw-r--r-- | mysql-test/t/func_time.test | 5 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 039640a5036..75c57c34171 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1533,3 +1533,6 @@ select least(greatest(f3, f2, f4), f5) from t1; least(greatest(f3, f2, f4), f5) 0000-00-00 00:00:00 drop table t1; +select day(coalesce(null)); +day(coalesce(null)) +NULL diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 7d143ed9c16..e4b52b0330c 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -968,3 +968,8 @@ insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00 select least(greatest(f3, f2, f4), f5) from t1; drop table t1; +# +# lp:737474 Wrong result with DAY(COALESCE(NULL)) in 5.1-micro +# +select day(coalesce(null)); + diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 2cbcbbdb55f..925582be542 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2917,7 +2917,7 @@ bool Item_func_coalesce::get_date(MYSQL_TIME *ltime,uint fuzzydate) return res; } null_value=1; - return 0; + return 1; } |