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
90d6195f
Commit
90d6195f
authored
Sep 22, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix handling of NULL values in decimal fields in FORMAT(). (Bug #13361)
parent
306dcf06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
0 deletions
+18
-0
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+6
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+10
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-0
No files found.
mysql-test/r/func_str.result
View file @
90d6195f
...
...
@@ -1011,3 +1011,9 @@ t
1000000
1
drop table t1;
create table t1 (d decimal default null);
insert into t1 values (null);
select format(d, 2) from t1;
format(d, 2)
NULL
drop table t1;
mysql-test/t/func_str.test
View file @
90d6195f
...
...
@@ -665,3 +665,13 @@ select rpad(i, 7, ' ') as t from t1;
drop
table
t1
;
# End of 4.1 tests
#
# Bug #13361: SELECT FORMAT(<decimal field with null>, 2) crashes
#
create
table
t1
(
d
decimal
default
null
);
insert
into
t1
values
(
null
);
select
format
(
d
,
2
)
from
t1
;
drop
table
t1
;
# End of 5.0 tests
sql/item_strfunc.cc
View file @
90d6195f
...
...
@@ -1733,6 +1733,8 @@ String *Item_func_format::val_str(String *str)
{
my_decimal
dec_val
,
rnd_dec
,
*
res
;
res
=
args
[
0
]
->
val_decimal
(
&
dec_val
);
if
((
null_value
=
args
[
0
]
->
null_value
))
return
0
;
/* purecov: inspected */
my_decimal_round
(
E_DEC_FATAL_ERROR
,
res
,
decimals
,
false
,
&
rnd_dec
);
my_decimal2string
(
E_DEC_FATAL_ERROR
,
&
rnd_dec
,
0
,
0
,
0
,
str
);
str_length
=
str
->
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