Re: BUG #2994: avg() calculates wrong on Interval-type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Frank F(dot) Burmo" <fburmo(at)online(dot)no>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2994: avg() calculates wrong on Interval-type
Date: 2007-02-12 21:14:49
Message-ID: 13275.1171314889@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Frank F. Burmo" <fburmo(at)online(dot)no> writes:
> The following avg()-call gives me a result of: "2 days, 27:53:49.359573"...
> which must be wrong. There are only 24 hours in a day.

That's a false premise. Days and hours/minutes/seconds are independent
components of an interval. Some days have 23 or 25 hours, therefore
e.g. "48 hours" is not interchangeable with "2 days". If you want to
assume it is, see justify_hours().

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2007-02-12 23:20:22 Re: BUG #2994: avg() calculates wrong on Interval-type
Previous Message Filippo Toso 2007-02-12 20:08:11 Re: BUG #2993: The program "postgres" is needed by initdb but was not found ...