Skip site navigation (1) Skip section navigation (2)

Re: Aggregate Function (AVG) not calculated correctly

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gavin(at)consultant(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Aggregate Function (AVG) not calculated correctly
Date: 2000-12-05 15:31:18
Message-ID: 14495.976030278@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
pgsql-bugs(at)postgresql(dot)org writes:
> I have included all code needed to prove the bug,

No, you haven't: where are the table declarations?

But I'll take a guess anyway: you declared "distance" as int2, didn't
you?  AVG(int2) currently uses an int2 accumulator, and you're suffering
overflow.  Try "AVG(distance::float8)" instead.

We've changed AVG() to use a numeric accumulator for 7.1, but that
won't help you today.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Thomas LockhartDate: 2000-12-05 15:47:14
Subject: Re: Aggregate Function (AVG) not calculated correctly
Previous:From: Tim DunningtonDate: 2000-12-05 15:21:13
Subject: renaming columns do not update foreign key triggers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group