summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-09-22 11:40:22 -0700
committerunknown <jimw@mysql.com>2005-09-22 11:40:22 -0700
commit0f0f72c74f87c4cffca23704bd4a94b86b3945af (patch)
tree7a0080bcde54138749411a1c0af3a6cb0331d762 /sql/item_strfunc.cc
parentd2fc3bd4245f8c212046e88151da4a66d1b048b3 (diff)
downloadmariadb-git-0f0f72c74f87c4cffca23704bd4a94b86b3945af.tar.gz
Fix handling of NULL values in decimal fields in FORMAT(). (Bug #13361)
mysql-test/r/func_str.result: Add new results mysql-test/t/func_str.test: Add new regression test sql/item_strfunc.cc: Handle NULL decimal fields in FORMAT().
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 54c476ce176..b9ae3140393 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -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();