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
38494220
Commit
38494220
authored
Jun 08, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-5.0
into deer.(none):/home/hf/work/mysql-5.0.9764
parents
f0ee7369
6c148a79
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
15 deletions
+29
-15
mysql-test/r/create.result
mysql-test/r/create.result
+1
-1
mysql-test/r/distinct.result
mysql-test/r/distinct.result
+8
-0
mysql-test/t/distinct.test
mysql-test/t/distinct.test
+8
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+12
-14
No files found.
mysql-test/r/create.result
View file @
38494220
...
...
@@ -434,7 +434,7 @@ d date YES NULL
e varchar(1) NO
f datetime YES NULL
g time YES NULL
h
varbinary(23)
NO
h
longblob
NO
dd time YES NULL
select * from t2;
a b c d e f g h dd
...
...
mysql-test/r/distinct.result
View file @
38494220
...
...
@@ -464,3 +464,11 @@ SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
html prod
1 0.0000
drop table t1;
create table t1 (id int, dsc varchar(50));
insert into t1 values (1, "line number one"), (2, "line number two"), (3, "line number three");
select distinct id, IFNULL(dsc, '-') from t1;
id IFNULL(dsc, '-')
1 line number one
2 line number two
3 line number three
drop table t1;
mysql-test/t/distinct.test
View file @
38494220
...
...
@@ -332,3 +332,11 @@ CREATE TABLE t1 (
INSERT
INTO
t1
VALUES
(
'1'
,
1
,
0
);
SELECT
DISTINCT
html
,
SUM
(
rout
)
/
(
SUM
(
rin
)
+
1
)
as
'prod'
FROM
t1
GROUP
BY
rin
;
drop
table
t1
;
#
# Bug 9784 DISTINCT IFNULL truncates data
#
create
table
t1
(
id
int
,
dsc
varchar
(
50
));
insert
into
t1
values
(
1
,
"line number one"
),
(
2
,
"line number two"
),
(
3
,
"line number three"
);
select
distinct
id
,
IFNULL
(
dsc
,
'-'
)
from
t1
;
drop
table
t1
;
sql/item_cmpfunc.cc
View file @
38494220
...
...
@@ -1109,12 +1109,14 @@ void Item_func_between::print(String *str)
void
Item_func_ifnull
::
fix_length_and_dec
()
{
agg_result_type
(
&
hybrid_type
,
args
,
2
);
maybe_null
=
args
[
1
]
->
maybe_null
;
decimals
=
max
(
args
[
0
]
->
decimals
,
args
[
1
]
->
decimals
);
max_length
=
(
max
(
args
[
0
]
->
max_length
-
args
[
0
]
->
decimals
,
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
)
+
decimals
);
agg_result_type
(
&
hybrid_type
,
args
,
2
);
max_length
=
(
hybrid_type
==
DECIMAL_RESULT
||
hybrid_type
==
INT_RESULT
)
?
(
max
(
args
[
0
]
->
max_length
-
args
[
0
]
->
decimals
,
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
)
+
decimals
)
:
max
(
args
[
0
]
->
max_length
,
args
[
1
]
->
max_length
);
switch
(
hybrid_type
)
{
case
STRING_RESULT
:
agg_arg_charsets
(
collation
,
args
,
arg_count
,
MY_COLL_CMP_CONV
);
...
...
@@ -1225,16 +1227,7 @@ Item_func_if::fix_length_and_dec()
{
maybe_null
=
args
[
1
]
->
maybe_null
||
args
[
2
]
->
maybe_null
;
decimals
=
max
(
args
[
1
]
->
decimals
,
args
[
2
]
->
decimals
);
if
(
decimals
==
NOT_FIXED_DEC
)
{
max_length
=
max
(
args
[
1
]
->
max_length
,
args
[
2
]
->
max_length
);
}
else
{
max_length
=
(
max
(
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
,
args
[
2
]
->
max_length
-
args
[
2
]
->
decimals
)
+
decimals
);
}
enum
Item_result
arg1_type
=
args
[
1
]
->
result_type
();
enum
Item_result
arg2_type
=
args
[
2
]
->
result_type
();
bool
null1
=
args
[
1
]
->
const_item
()
&&
args
[
1
]
->
null_value
;
...
...
@@ -1263,6 +1256,11 @@ Item_func_if::fix_length_and_dec()
collation
.
set
(
&
my_charset_bin
);
// Number
}
}
max_length
=
(
cached_result_type
==
DECIMAL_RESULT
||
cached_result_type
==
INT_RESULT
)
?
(
max
(
args
[
1
]
->
max_length
-
args
[
1
]
->
decimals
,
args
[
2
]
->
max_length
-
args
[
2
]
->
decimals
)
+
decimals
)
:
max
(
args
[
1
]
->
max_length
,
args
[
2
]
->
max_length
);
}
...
...
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