summaryrefslogtreecommitdiff
path: root/sql/item_cmpfunc.cc
diff options
context:
space:
mode:
authorSinisa@sinisa.nasamreza.org <>2002-08-09 23:14:02 +0300
committerSinisa@sinisa.nasamreza.org <>2002-08-09 23:14:02 +0300
commita80d185e403720d060aa5c61a09e962e0abfb1f8 (patch)
tree6798f91768273fd1b7f7f80760084855d64d2523 /sql/item_cmpfunc.cc
parentedf3929cd589d150adccefc754a979ce7e5d7e36 (diff)
downloadmariadb-git-a80d185e403720d060aa5c61a09e962e0abfb1f8.tar.gz
A change in IF behaviour that several users asked for ...
Diffstat (limited to 'sql/item_cmpfunc.cc')
-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)
{