diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_cmpfunc.cc | 6 |
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) { |