Re: BUG #2994: avg() calculates wrong on Interval-type - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2994: avg() calculates wrong on Interval-type
Date
Msg-id 13275.1171314889@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2994: avg() calculates wrong on Interval-type  ("Frank F. Burmo" <fburmo@online.no>)
Responses Re: BUG #2994: avg() calculates wrong on Interval-type
List pgsql-bugs
"Frank F. Burmo" <fburmo@online.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

pgsql-bugs by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: BUG #2993: The program "postgres" is needed by initdb but was not found ...
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #2994: avg() calculates wrong on Interval-type