summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2008-04-25 00:39:37 +0400
committerunknown <evgen@moonbone.local>2008-04-25 00:39:37 +0400
commit89b866e7bfc8965046626844ee22ecd5b4e5a774 (patch)
tree64a46def2a09286fa91afe396c562e2ae55f1863 /mysql-test
parent415112a9406c689fa4f3ec27c1c8135d2825b14c (diff)
downloadmariadb-git-89b866e7bfc8965046626844ee22ecd5b4e5a774.tar.gz
Bug#36023: Incorrect handling of zero length caused an assertion to fail.
When a zero length is provided to the my_decimal_length_to_precision function along with unsigned_flag set to false it returns a negative value. For queries that employs temporary tables may cause failed assertion or excessive memory consumption while temporary table creation. Now the my_decimal_length_to_precision and the my_decimal_precision_to_length functions take unsigned_flag into account only if the length/precision argument is non-zero. mysql-test/t/type_decimal.test: Added a test case for the bug#36023: Incorrect handling of zero length caused an assertion to fail. mysql-test/r/type_decimal.result: Added a test case for the bug#36023: Incorrect handling of zero length caused an assertion to fail. sql/my_decimal.h: Bug#36023: Incorrect handling of zero length caused an assertion to fail. Now the my_decimal_length_to_precision and the my_decimal_precision_to_length functions take unsigned_flag into account only if the length/precision argument is non-zero.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/type_decimal.result7
-rw-r--r--mysql-test/t/type_decimal.test8
2 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 2afd42f702e..03fbc898cc5 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -946,4 +946,11 @@ SELECT ROUND(20061108085411.000002);
ROUND(20061108085411.000002)
20061108085411
DROP TABLE t1, t2, t3, t4, t5, t6;
+create table t1(`c` decimal(9,2));
+insert into t1 values (300),(201.11);
+select max(case 1 when 1 then c else null end) from t1 group by c;
+max(case 1 when 1 then c else null end)
+201.11
+300.00
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 6841b3cdd68..8a81908296f 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -521,4 +521,12 @@ SELECT ROUND(20061108085411.000002);
DROP TABLE t1, t2, t3, t4, t5, t6;
+#
+# Bug#36023: Incorrect handling of zero length caused an assertion to fail.
+#
+create table t1(`c` decimal(9,2));
+insert into t1 values (300),(201.11);
+select max(case 1 when 1 then c else null end) from t1 group by c;
+drop table t1;
+
--echo End of 5.0 tests