[Commits] Rev 4080: MDEV-5781 Item_sum_std::val_real(): Assertion `nr >= 0.0' fails on query with STDDEV_POP, ROUND and variable in lp:~maria-captains/maria/10.0

Alexander Barkov bar at mariadb.org
Sun Mar 23 17:47:51 EET 2014


At lp:~maria-captains/maria/10.0

------------------------------------------------------------
revno: 4080
revision-id: bar at mariadb.org-20140323154301-ypa2lt5u6vd26ngy
parent: bar at mariadb.org-20140323111507-6v0smskvrh89shyh
committer: Alexander Barkov <bar at mariadb.org>
branch nick: maria-10.0
timestamp: Sun 2014-03-23 19:43:01 +0400
message:
  MDEV-5781 Item_sum_std::val_real(): Assertion `nr >= 0.0' fails on query with STDDEV_POP, ROUND and variable
=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2013-09-14 01:09:36 +0000
+++ b/mysql-test/r/func_math.result	2014-03-23 15:43:01 +0000
@@ -756,3 +756,18 @@ select 5 div 2.0;
 select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;
 5.9 div 2	1.23456789e3 DIV 2	1.23456789e9 DIV 2	1.23456789e19 DIV 2
 2	617	617283945	6172839450000000000
+#
+# End of 5.5 tests
+#
+#
+# Start of 10.0 tests
+#
+#
+# MDEV-5781 Item_sum_std::val_real(): Assertion `nr >= 0.0' fails on query with STDDEV_POP, ROUND and variable
+#
+SELECT STDDEV_POP(ROUND(0, at A:=2009)) FROM (SELECT 1 UNION SELECT 2) fake_table;
+STDDEV_POP(ROUND(0, at A:=2009))
+0.0000
+#
+# End of 10.0 tests
+#

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2012-05-04 12:02:35 +0000
+++ b/mysql-test/t/func_math.test	2014-03-23 15:43:01 +0000
@@ -559,3 +559,21 @@ select 5.0 div 2.0;
 select 5.0 div 2;
 select 5 div 2.0;
 select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
+--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-5781 Item_sum_std::val_real(): Assertion `nr >= 0.0' fails on query with STDDEV_POP, ROUND and variable
+--echo #
+SELECT STDDEV_POP(ROUND(0, at A:=2009)) FROM (SELECT 1 UNION SELECT 2) fake_table;
+
+
+--echo #
+--echo # End of 10.0 tests
+--echo #

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2014-02-19 10:05:15 +0000
+++ b/sql/item_func.cc	2014-03-23 15:43:01 +0000
@@ -2666,6 +2666,9 @@ double my_double_round(double value, lon
   volatile double value_div_tmp= value / tmp;
   volatile double value_mul_tmp= value * tmp;
 
+  if (!dec_negative && my_isinf(tmp)) // "dec" is too large positive number
+    return value;
+
   if (dec_negative && my_isinf(tmp))
     tmp2= 0.0;
   else if (!dec_negative && my_isinf(value_mul_tmp))



More information about the commits mailing list