Commit aa0c8235 authored by Sergey Glukhov's avatar Sergey Glukhov

Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION

Assertion happens due to missing NULL value check in
Item_func_round::fix_length_and_dec() function.
The fix: added NULL value check for second parameter.
parent 90df87e4
......@@ -540,4 +540,10 @@ ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'))
-4939092.0000
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
#
# Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
#
SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
SUM(DISTINCT (TRUNCATE((.1), NULL)))
NULL
End of 5.1 tests
......@@ -349,4 +349,10 @@ DROP TABLE t1;
SELECT ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a'));
--echo #
--echo # Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION
--echo #
SELECT SUM(DISTINCT (TRUNCATE((.1), NULL)));
--echo End of 5.1 tests
......@@ -1972,6 +1972,9 @@ void Item_func_round::fix_length_and_dec()
}
val1= args[1]->val_int();
if ((null_value= args[1]->is_null()))
return;
val1_unsigned= args[1]->unsigned_flag;
if (val1 < 0)
decimals_to_set= val1_unsigned ? INT_MAX : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment