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

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gene Sokolov <hook(at)aktrad(dot)ru>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )
Date: 1999-06-16 15:29:58
Message-ID: 3767C2F6.CC011A4E@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)alumni(dot)caltech(dot)edu
South Pasadena, California

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-06-16 15:30:58 Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )
Previous Message José Soares 1999-06-16 15:28:39 SET QUERY_LIMIT bug report