summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-08-09 23:14:02 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2002-08-09 23:14:02 +0300
commit46f5b2674fd2812cf1f77412ecd20561fe9d3d30 (patch)
tree6798f91768273fd1b7f7f80760084855d64d2523 /sql
parentb9b404b1ce9597d2e16a6be8c45e313d4f1a802a (diff)
downloadmariadb-git-46f5b2674fd2812cf1f77412ecd20561fe9d3d30.tar.gz
A change in IF behaviour that several users asked for ...
Diffstat (limited to 'sql')
-rw-r--r--sql/item_cmpfunc.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index ae50090fea1..86e2ef29564 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -494,6 +494,12 @@ Item_func_if::fix_length_and_dec()
decimals=max(args[1]->decimals,args[2]->decimals);
enum Item_result arg1_type=args[1]->result_type();
enum Item_result arg2_type=args[2]->result_type();
+ bool null1=args[1]->null_value;
+ bool null2=args[2]->null_value;
+ if (null1 && !null2)
+ arg1_type=arg2_type;
+ else if (!null1 && null2)
+ arg2_type=arg1_type;
binary=1;
if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT)
{