Re: [HACKERS] Sum aggregate calculation for single precsion real

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Sum aggregate calculation for single precsion real
Дата
Msg-id 12546.1487133938@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Sum aggregate calculation for single precsion real  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [HACKERS] Sum aggregate calculation for single precsion real  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Well put.  Although it's worth noting that we aren't 100% consistent
> about this stuff: sum(smallint), sum(integer), and sum(bigint) all use
> an output data type different from the input data type, but other
> versions of sum() don't.

In those cases I believe the main reason for the different output type is
that there's a significant risk of overflow if we don't.  See commits
bec98a31c and 5f7c2bdb5 for some history.

You could perhaps make an argument that sum(float4) would have less risk
of overflow if it accumulated in and returned float8, but frankly that
seems a bit thin.
        regards, tom lane



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: [HACKERS] parallelize queries containing subplans
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] operator_precedence_warning vs make installcheck