mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for bug #24912 "problems with bigint in abs() ceiling() round() truncate() mod()" and a number of related problems:
- unsigned flag was not handled correctly for a number of mathematical funcions, which led to incorrect results - passing large values as the number of decimals to ROUND() resulted in incorrect results and even server crashes in some cases - reverted the fix and the testcase for bug #10083 as it violates the manual - fixed some testcases which relied on broken ROUND() behavior
This commit is contained in:
@ -82,11 +82,6 @@ select format(col2,6) from t1 where col1=7;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #10083 (round doesn't increase decimals)
|
||||
#
|
||||
select round(150, 2);
|
||||
|
||||
#
|
||||
# Bug @10632 (Ceiling function returns wrong answer)
|
||||
#
|
||||
@ -177,3 +172,37 @@ select format(t2.f2-t2.f1+1,0) from t1,t2
|
||||
where t1.f2 = t2.f3 order by t1.f1;
|
||||
drop table t1, t2;
|
||||
set names default;
|
||||
|
||||
# Bug 24912 -- misc functions have trouble with unsigned
|
||||
|
||||
select cast(-2 as unsigned), 18446744073709551614, -2;
|
||||
select abs(cast(-2 as unsigned)), abs(18446744073709551614), abs(-2);
|
||||
select ceiling(cast(-2 as unsigned)), ceiling(18446744073709551614), ceiling(-2);
|
||||
select floor(cast(-2 as unsigned)), floor(18446744073709551614), floor(-2);
|
||||
select format(cast(-2 as unsigned), 2), format(18446744073709551614, 2), format(-2, 2);
|
||||
select sqrt(cast(-2 as unsigned)), sqrt(18446744073709551614), sqrt(-2);
|
||||
select round(cast(-2 as unsigned), 1), round(18446744073709551614, 1), round(-2, 1);
|
||||
select round(4, cast(-2 as unsigned)), round(4, 18446744073709551614), round(4, -2);
|
||||
select truncate(cast(-2 as unsigned), 1), truncate(18446744073709551614, 1), truncate(-2, 1);
|
||||
select truncate(4, cast(-2 as unsigned)), truncate(4, 18446744073709551614), truncate(4, -2);
|
||||
select round(10000000000000000000, -19), truncate(10000000000000000000, -19);
|
||||
select round(1e0, -309), truncate(1e0, -309);
|
||||
select round(1e1,308), truncate(1e1, 308);
|
||||
select round(1e1, 2147483648), truncate(1e1, 2147483648);
|
||||
select round(1.1e1, 4294967295), truncate(1.1e1, 4294967295);
|
||||
select round(1.12e1, 4294967296), truncate(1.12e1, 4294967296);
|
||||
select round(1.5, 2147483640), truncate(1.5, 2147483640);
|
||||
select round(1.5, -2147483649), round(1.5, 2147483648);
|
||||
select truncate(1.5, -2147483649), truncate(1.5, 2147483648);
|
||||
select round(1.5, -4294967296), round(1.5, 4294967296);
|
||||
select truncate(1.5, -4294967296), truncate(1.5, 4294967296);
|
||||
select round(1.5, -9223372036854775808), round(1.5, 9223372036854775808);
|
||||
select truncate(1.5, -9223372036854775808), truncate(1.5, 9223372036854775808);
|
||||
select round(1.5, 18446744073709551615), truncate(1.5, 18446744073709551615);
|
||||
select round(18446744073709551614, -1), truncate(18446744073709551614, -1);
|
||||
select round(4, -4294967200), truncate(4, -4294967200);
|
||||
select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3);
|
||||
select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2);
|
||||
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user