avg is forgetting to divide by the count. This works fine:

=> select (sum(amount)/count(amount)) as avg from trans;
avg
------
$18.21
(1 row)
I have a patch, and will commit it today or tomorrow. Thanks.

- Tom

postgres=> create table t (m money);
CREATE
postgres=> insert into t values ('$1.00');
INSERT 17422 1
postgres=> insert into t values ('$3.00');
INSERT 17423 1
postgres=> select avg(m) from t;
avg
-----
$2.00
(1 row)
Any way I can get read-only CVS access, or SUP or something similar?
Thomas, when you get it done, can you post the patch query to 'patches'
so he can get it, or do we need to add a new function to the backend?

The 6.2.1 is due on this Friday, so the wait will not be long.

- --
Bruce Momjian
maillist@candle.pha.pa.us

------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedOct 14, '97 at 8:03p
activeOct 14, '97 at 8:03p
posts1
users1
websitepostgresql.org...
irc#postgresql

1 user in discussion

Bruce Momjian: 1 post

People

Translate

site design / logo © 2021 Grokbase