Re: BUG #2477: Aggregate Integer divisors incorrectly yield integer-type quotient

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2477: Aggregate Integer divisors incorrectly yield integer-type quotient
Дата
Msg-id 29738.1150081389@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #2477: Aggregate Integer divisors incorrectly yield integer-type quotient  ("John Rylander" <rylander@prolexia.com>)
Список pgsql-bugs
"John Rylander" <rylander@prolexia.com> writes:
> When for some reason I did a sum/count instead of an avg, the result was
> always an integer (either 0 or 1):

What's your point?  Postgres has always defined division of integers as
yielding an integer result.  AFAICS this choice is fully sanctioned by
the SQL standard:

         1) If the data type of both operands of a dyadic arithmetic opera-
            tor is exact numeric, then the data type of the result is exact
            numeric, with precision and scale determined as follows:
            ...
            d) The precision and scale of the result of division is
              implementation-defined.

(SQL92 6.12 <numeric value expression> syntax rule 1)

> Yet another maddening PostgreSQL bug/idiosyncrasy.  Time for this boy to go
> to Oracle

Sayonara.  Last I checked, they had a few idiosyncrasies too.

            regards, tom lane

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

Предыдущее
От: "Alexander Cordeiro"
Дата:
Сообщение: BUG #2476: Instalation problem
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: BUG #2477: Aggregate Integer divisors incorrectly yield integer-type quotient