mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Fix for bug #8464 (AVG returns incorrect result)
Actually problem was not in AVG function, but in SUM before the AVG in the query. mysql-test/r/func_group.result: appropriate test result mysql-test/t/func_group.test: test case added strings/decimal.c: in this case we also need to make fsizes equal
This commit is contained in:
parent
0ae5efb4dc
commit
07d5ddb755
3 changed files with 24 additions and 0 deletions
|
|
@ -832,3 +832,13 @@ id stddev_pop(value1) var_pop(value1) stddev_samp(value1) var_samp(value1)
|
|||
1 0.816497 0.666667 1.000000 1.000000
|
||||
2 1.118034 1.250000 1.290994 1.666667
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (col1 decimal(16,12));
|
||||
INSERT INTO t1 VALUES (-5.00000000001),(-5.00000000002),(-5.00000000003),(-5.00000000000),(-5.00000000001),(-5.00000000002);
|
||||
insert into t1 select * from t1;
|
||||
select col1,count(col1),sum(col1),avg(col1) from t1 group by col1;
|
||||
col1 count(col1) sum(col1) avg(col1)
|
||||
-5.000000000030 2 -10.000000000060 -5.0000000000300000
|
||||
-5.000000000020 4 -20.000000000080 -5.0000000000200000
|
||||
-5.000000000010 4 -20.000000000040 -5.0000000000100000
|
||||
-5.000000000000 2 -10.000000000000 -5.0000000000000000
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue