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

From: wieck(at)debis(dot)com (Jan Wieck)
To: lockhart(at)alumni(dot)caltech(dot)edu (Thomas Lockhart)
Cc: 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 14:06:58
Message-ID: m10uGLC-0003krC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Lockhart wrote:

>
> > [PostgreSQL 6.5.0 on i386-unknown-freebsd3.2, compiled by gcc 2.7.2.1]
> > test1=> select count(*), max("ID"), min("ID"), avg("ID") from "ItemsBars";
> > count| max| min| avg
> > ------+-------+-----+----
> > 677719|3075717|61854|-251
> > (1 row)
> > Overflow, perhaps?
>
> Of course. These are integer fields? I've been considering changing
> all accumulators (and results) for integer aggregate functions to
> float8, but have not done so yet. I was sort of waiting for a v7.0
> release, but am not sure why...

Wouldn't it be better to use NUMERIC for the avg(int) state
values? It will never loose any significant digit.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#========================================= wieck(at)debis(dot)com (Jan Wieck) #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-06-16 14:13:15 Re: [HACKERS] Postgres mailing lists
Previous Message Thomas Lockhart 1999-06-16 14:03:38 Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )