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
7dc2426b
Commit
7dc2426b
authored
Jun 07, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#3987 - if(int, aggregate(int))
parent
256bada7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
mysql-test/r/func_if.result
mysql-test/r/func_if.result
+6
-0
mysql-test/t/func_if.test
mysql-test/t/func_if.test
+9
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+2
-2
No files found.
mysql-test/r/func_if.result
View file @
7dc2426b
...
@@ -58,3 +58,9 @@ select min(if(y -x > 5,y,NULL)), max(if(y - x > 5,y,NULL)) from t1;
...
@@ -58,3 +58,9 @@ select min(if(y -x > 5,y,NULL)), max(if(y - x > 5,y,NULL)) from t1;
min(if(y -x > 5,y,NULL)) max(if(y - x > 5,y,NULL))
min(if(y -x > 5,y,NULL)) max(if(y - x > 5,y,NULL))
6 56
6 56
drop table t1;
drop table t1;
create table t1 (a int);
insert t1 values (1),(2);
select if(1>2,a,avg(a)) from t1;
if(1>2,a,avg(a))
1.5000
drop table t1;
mysql-test/t/func_if.test
View file @
7dc2426b
...
@@ -38,3 +38,12 @@ create table t1 (x int, y int);
...
@@ -38,3 +38,12 @@ create table t1 (x int, y int);
insert
into
t1
values
(
0
,
6
),(
10
,
16
),(
20
,
26
),(
30
,
10
),(
40
,
46
),(
50
,
56
);
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
;
select
min
(
if
(
y
-
x
>
5
,
y
,
NULL
)),
max
(
if
(
y
-
x
>
5
,
y
,
NULL
))
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# BUG#3987
#
create
table
t1
(
a
int
);
insert
t1
values
(
1
),(
2
);
select
if
(
1
>
2
,
a
,
avg
(
a
))
from
t1
;
drop
table
t1
;
sql/item_cmpfunc.cc
View file @
7dc2426b
...
@@ -535,8 +535,8 @@ Item_func_if::fix_length_and_dec()
...
@@ -535,8 +535,8 @@ Item_func_if::fix_length_and_dec()
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
bool
null1
=
args
[
1
]
->
null_value
;
bool
null1
=
args
[
1
]
->
const_item
()
&&
args
[
1
]
->
null_value
;
bool
null2
=
args
[
2
]
->
null_value
;
bool
null2
=
args
[
2
]
->
const_item
()
&&
args
[
2
]
->
null_value
;
if
(
null1
)
if
(
null1
)
{
{
...
...
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