Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )

Thomas Lockhart <lockhart@alumni.caltech.edu>

From: Thomas Lockhart <lockhart@alumni.caltech.edu>
To: "Jackson, DeJuan" <djackson@cpsgroup.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Gene Sokolov <hook@aktrad.ru>, pgsql-hackers@postgreSQL.org
Date: 1999-06-16T15:29:58Z
Lists: pgsql-hackers
> What does the spec have to say?  It bothers me somewhat that an AVG is
> expected to return an integer result at all.  Isn't the Average of 1 and 2,
> 1.5 not 1?

Yeah, well, it's a holdover from the original Postgres code. We just
haven't made an effort to change it yet, but it seems a good candidate
for a makeover, no?

I'm pretty sure that the spec would suggest a float8 return value for
avg(int), but I haven't looked recently to refresh my memory.

                - Thomas

-- 
Thomas Lockhart				lockhart@alumni.caltech.edu
South Pasadena, California