Re: how to get a number of seconds in some interval ? - Mailing list pgsql-admin

From Tom Lane
Subject Re: how to get a number of seconds in some interval ?
Date
Msg-id 20080.1210604951@sss.pgh.pa.us
Whole thread Raw
In response to Re: how to get a number of seconds in some interval ?  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Responses Re: how to get a number of seconds in some interval ?  (Julius Tuskenis <julius@nsoft.lt>)
Re: how to get a number of seconds in some interval ?  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
List pgsql-admin
Achilleas Mantzios <achill@matrix.gatewaynet.com> writes:
> Στις Monday 12 May 2008 17:32:39 ο/η Julius Tuskenis έγραψε:
>> do you know why division of intervals was not implemented? As I see it -
>> there should be an easy way to do so. '1 hour 30 minutes' / '1 hour' =
>> 1.5 .... Seems straight forward...
>>
> No idea why. However as you pose it,it makes sense.

No, it doesn't really, because intervals contain multiple components.
What would you define as the result of
    '1 month 1 hour' / '1 day'
bearing in mind that the number of days per month is not fixed, and
neither is the number of hours per day?

You can derive a number if you're willing to make arbitrary assumptions
about the relationships of the different units (as indeed extract(epoch)
does), but hard-wiring such assumptions into a basic arithmetic operator
doesn't seem like a good idea to me.

            regards, tom lane

pgsql-admin by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: how to get a number of seconds in some interval ?
Next
From: "Travis Smith"
Date:
Subject: Postgres cluster on Solaris