View Single Post

   
  #2 (permalink)  
Old 04-10-2008, 10:03 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #2477: Aggregate Integer divisors incorrectly yield integer-type quotient

"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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply With Quote