Commit 6b5f9d4f authored by unknown's avatar unknown

Fix for bug #5595: NULLIF() IS NULL returns false if NULLIF() returns NULL

parent e8bc5611
......@@ -64,3 +64,6 @@ select if(1>2,a,avg(a)) from t1;
if(1>2,a,avg(a))
1.5000
drop table t1;
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
NULLIF(5,5) IS NULL NULLIF(5,5) IS NOT NULL
1 0
......@@ -47,3 +47,7 @@ insert t1 values (1),(2);
select if(1>2,a,avg(a)) from t1;
drop table t1;
#
# Bug #5595 NULLIF() IS NULL returns false if NULLIF() returns NULL
#
SELECT NULLIF(5,5) IS NULL, NULLIF(5,5) IS NOT NULL;
......@@ -654,6 +654,15 @@ Item_func_nullif::val_str(String *str)
return res;
}
bool
Item_func_nullif::is_null()
{
if (!(this->*cmp_func)())
return null_value=1;
return 0;
}
/*
CASE expression
Return the matching ITEM or NULL if all compares (including else) failed
......
......@@ -240,6 +240,7 @@ class Item_func_nullif :public Item_bool_func2
void fix_length_and_dec();
const char *func_name() const { return "nullif"; }
table_map not_null_tables() const { return 0; }
bool is_null();
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment