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

From Peter Eisentraut
Subject Re: BUG #2994: avg() calculates wrong on Interval-type
Date
Msg-id 200702130020.23365.peter_e@gmx.net
Whole thread Raw
In response to Re: BUG #2994: avg() calculates wrong on Interval-type  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #2994: avg() calculates wrong on Interval-type  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom Lane wrote:
> "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.

I don't understand how it does the computation then.  None of his input
data contains hour/minute/second components in excess of 24 hours, so
to arrive at 27-some hours it must have pulled over some days.

Moreover, my system thinks that the average of '1 day 12 hours' and '8
hours' is 22 hours, and also that the average of '2 days' and '3 days'
is 2 days and 12 hours, so it does make the assumption that 1 day = 24
hours.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2994: avg() calculates wrong on Interval-type
Next
From: Tom Lane
Date:
Subject: Re: BUG #2994: avg() calculates wrong on Interval-type