List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:September 22 2005 8:40pm
Subject:bk commit into 5.0 tree (jimw:1.1998) BUG#13361
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1998 05/09/22 11:40:22 jimw@stripped +3 -0
  Fix handling of NULL values in decimal fields in FORMAT(). (Bug #13361)

  sql/item_strfunc.cc
    1.255 05/09/22 11:40:18 jimw@stripped +2 -0
    Handle NULL decimal fields in FORMAT().

  mysql-test/t/func_str.test
    1.81 05/09/22 11:40:18 jimw@stripped +10 -0
    Add new regression test

  mysql-test/r/func_str.result
    1.107 05/09/22 11:40:18 jimw@stripped +6 -0
    Add new results

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-13361

--- 1.254/sql/item_strfunc.cc	2005-09-20 11:24:21 -07:00
+++ 1.255/sql/item_strfunc.cc	2005-09-22 11:40:18 -07:00
@@ -1733,6 +1733,8 @@
   {
     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();

--- 1.106/mysql-test/r/func_str.result	2005-08-26 22:25:00 -07:00
+++ 1.107/mysql-test/r/func_str.result	2005-09-22 11:40:18 -07:00
@@ -1011,3 +1011,9 @@
 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;

--- 1.80/mysql-test/t/func_str.test	2005-08-11 04:02:41 -07:00
+++ 1.81/mysql-test/t/func_str.test	2005-09-22 11:40:18 -07:00
@@ -665,3 +665,13 @@
 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
Thread
bk commit into 5.0 tree (jimw:1.1998) BUG#13361Jim Winstead22 Sep