3267 Tor Didriksen 2011-07-18 [merge]
merge 5.5 => trunk
modified:
mysql-test/r/func_math.result
mysql-test/t/func_math.test
sql/item_func.cc
3266 Tor Didriksen 2011-07-18 [merge]
Merge 5.5 => trunk.
Add unit tests for my_decimal_mod().
@ unittest/gunit/CMakeLists.txt
my_decimal test now needs server code (for error reporting)
@ unittest/gunit/my_decimal-t.cc
Add unit tests for my_decimal_mod().
modified:
mysql-test/r/func_math.result
mysql-test/t/func_math.test
strings/decimal.c
unittest/gunit/CMakeLists.txt
unittest/gunit/my_decimal-t.cc
=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result 2011-07-18 08:06:21 +0000
+++ b/mysql-test/r/func_math.result 2011-07-18 09:38:13 +0000
@@ -709,3 +709,22 @@ foo
select 999999999999999999999999999999999999999999999999999999999999999999999999999999999 % 0.0 as foo;
foo
NULL
+#
+# Bug#12711164 - 61676:
+# RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE
+#
+select 5 div 2;
+5 div 2
+2
+select 5.0 div 2.0;
+5.0 div 2.0
+2
+select 5.0 div 2;
+5.0 div 2
+2
+select 5 div 2.0;
+5 div 2.0
+2
+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
=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test 2011-07-18 08:06:21 +0000
+++ b/mysql-test/t/func_math.test 2011-07-18 09:38:13 +0000
@@ -547,3 +547,14 @@ let $nine_81=
eval select $nine_81 % 0.1 as foo;
eval select $nine_81 % 0.0 as foo;
+
+--echo #
+--echo # Bug#12711164 - 61676:
+--echo # RESULT OF DIV WITH DECIMAL AND INTEGER DOES NOT MAKE SENSE
+--echo #
+
+select 5 div 2;
+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;
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2011-07-07 11:24:33 +0000
+++ b/sql/item_func.cc 2011-07-18 09:38:13 +0000
@@ -1621,8 +1621,13 @@ longlong Item_func_int_div::val_int()
return 0;
}
+ my_decimal truncated;
+ const bool do_truncate= true;
+ if (my_decimal_round(E_DEC_FATAL_ERROR, &tmp, 0, do_truncate, &truncated))
+ DBUG_ASSERT(false);
+
longlong res;
- if (my_decimal2int(E_DEC_FATAL_ERROR, &tmp, unsigned_flag, &res) &
+ if (my_decimal2int(E_DEC_FATAL_ERROR, &truncated, unsigned_flag, &res) &
E_DEC_OVERFLOW)
raise_integer_overflow();
return res;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (tor.didriksen:3266 to 3267) | Tor Didriksen | 18 Jul |