summaryrefslogtreecommitdiff
path: root/mysql-test
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 /mysql-test
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 'mysql-test')
-rw-r--r--mysql-test/r/func_str.result6
-rw-r--r--mysql-test/t/func_str.test10
2 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 577f943ebde..3d7d693cdce 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -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;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 4a6c98c8d7f..5f32b7b2b49 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -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