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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
46f5b267
Commit
46f5b267
authored
Aug 09, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A change in IF behaviour that several users asked for ...
parent
b9b404b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
0 deletions
+20
-0
Docs/manual.texi
Docs/manual.texi
+8
-0
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+2
-0
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+4
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+6
-0
No files found.
Docs/manual.texi
View file @
46f5b267
...
...
@@ -46924,6 +46924,14 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0
@end menu
@node News-3.23.53, News-3.23.52, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.53
@itemize @bullet
@item
Changed behaviour that IF(condition,column,NULL) returns column type
@end itemize
@node News-3.23.52, News-3.23.51, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.52
@itemize @bullet
mysql-test/r/func_if.result
View file @
46f5b267
...
...
@@ -33,3 +33,5 @@ aa
aaa
sum(if(num is null,0.00,num))
144.54
min(if(y -x > 5,y,NULL)) max(if(y - x > 5,y,NULL))
6 56
mysql-test/t/func_if.test
View file @
46f5b267
...
...
@@ -28,3 +28,7 @@ create table t1 (num double(12,2));
insert
into
t1
values
(
144.54
);
select
sum
(
if
(
num
is
null
,
0.00
,
num
))
from
t1
;
drop
table
t1
;
create
table
t1
(
x
int
,
y
int
);
insert
into
t1
values
(
0
,
6
),(
10
,
16
),(
20
,
26
),(
30
,
10
),(
40
,
46
),(
50
,
56
);
select
min
(
if
(
y
-
x
>
5
,
y
,
NULL
)),
max
(
if
(
y
-
x
>
5
,
y
,
NULL
))
from
t1
;
drop
table
t1
;
sql/item_cmpfunc.cc
View file @
46f5b267
...
...
@@ -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
)
{
...
...
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