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

Поиск
Список
Период
Сортировка
От Gene Sokolov
Тема Re: [HACKERS] 6.5.0 - Overflow bug in AVG( )
Дата
Msg-id 1ad801beb7fb$ea60a870$0d8cdac3@aktrad.ru
обсуждение исходный текст
Ответ на 6.5.0 - Overflow bug in AVG( )  ("Gene Sokolov" <hook@aktrad.ru>)
Список pgsql-hackers
> > [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

Yes, the fields are int4

> 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...

Float8 accumulator seems to be a good solution if AVG is limited to
int/float types. I wonder if it could produce system dependency in AVG due
to rounding errors. Some broader solution should be considered though if you
want AVG to work on numeric/decimal as well.

Gene Sokolov.




В списке pgsql-hackers по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: Re: [HACKERS] Postgres mailing lists
Следующее
От: José Soares
Дата:
Сообщение: having bug report