Bug #100258 decimal returned function value overflow
Submitted: 20 Jul 2020 4:26 Modified: 20 Jul 2020 4:45
Reporter: andy zhang Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: decimal function

[20 Jul 2020 4:26] andy zhang
When select list has function of decimal type, it's possible it is overflowed due to the incorrect integer part and precision.

How to repeat:
create table decimal_test(c1 int, c2 int);
insert into decimal_test values(97, 1);
select 27 DIV (C2/C1) / 17 from decimal_test;

---> return 99.9999 instead of expected 154.0588
[20 Jul 2020 4:27] andy zhang
It has nothing to do with group by.
[20 Jul 2020 4:45] andy zhang
Please refer to bug #100259 for correct description.