Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6b5f9d4f
Commit
6b5f9d4f
authored
Sep 18, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #5595: NULLIF() IS NULL returns false if NULLIF() returns NULL
parent
e8bc5611
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
0 deletions
+17
-0
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+3
-0
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+4
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+9
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-0
No files found.
mysql-test/r/func_if.result
View file @
6b5f9d4f
...
@@ -64,3 +64,6 @@ select if(1>2,a,avg(a)) from t1;
...
@@ -64,3 +64,6 @@ select if(1>2,a,avg(a)) from t1;
if(1>2,a,avg(a))
if(1>2,a,avg(a))
1.5000
1.5000
drop table t1;
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
mysql-test/t/func_if.test
View file @
6b5f9d4f
...
@@ -47,3 +47,7 @@ insert t1 values (1),(2);
...
@@ -47,3 +47,7 @@ insert t1 values (1),(2);
select
if
(
1
>
2
,
a
,
avg
(
a
))
from
t1
;
select
if
(
1
>
2
,
a
,
avg
(
a
))
from
t1
;
drop
table
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
;
sql/item_cmpfunc.cc
View file @
6b5f9d4f
...
@@ -654,6 +654,15 @@ Item_func_nullif::val_str(String *str)
...
@@ -654,6 +654,15 @@ Item_func_nullif::val_str(String *str)
return
res
;
return
res
;
}
}
bool
Item_func_nullif
::
is_null
()
{
if
(
!
(
this
->*
cmp_func
)())
return
null_value
=
1
;
return
0
;
}
/*
/*
CASE expression
CASE expression
Return the matching ITEM or NULL if all compares (including else) failed
Return the matching ITEM or NULL if all compares (including else) failed
...
...
sql/item_cmpfunc.h
View file @
6b5f9d4f
...
@@ -240,6 +240,7 @@ class Item_func_nullif :public Item_bool_func2
...
@@ -240,6 +240,7 @@ class Item_func_nullif :public Item_bool_func2
void
fix_length_and_dec
();
void
fix_length_and_dec
();
const
char
*
func_name
()
const
{
return
"nullif"
;
}
const
char
*
func_name
()
const
{
return
"nullif"
;
}
table_map
not_null_tables
()
const
{
return
0
;
}
table_map
not_null_tables
()
const
{
return
0
;
}
bool
is_null
();
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment