## Re: how to get a number of seconds in some interval ?

From: Tom Lane Achilleas Mantzios Julius Tuskenis , pgsql-admin(at)postgresql(dot)org Re: how to get a number of seconds in some interval ? 2008-05-12 15:09:11 20080.1210604951@sss.pgh.pa.us (view raw or whole thread) 2008-05-12 13:44:16 from Julius Tuskenis  2008-05-12 14:24:38 from Achilleas Mantzios   2008-05-12 15:01:34 from Achilleas Mantzios    2008-05-12 15:09:11 from Tom Lane     2008-05-13 06:20:09 from Julius Tuskenis     2008-05-13 06:56:50 from Achilleas Mantzios      2008-05-13 08:22:28 from "Scott Marlowe"       2008-05-13 08:41:00 from Achilleas Mantzios       2008-05-13 08:42:41 from Shane Ambler        2008-05-13 08:48:32 from "Scott Marlowe"      2008-05-13 14:15:27 from Tom Lane pgsql-admin
Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)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

### Responses

 Next: From: Travis Smith Date: 2008-05-12 16:41:04 Subject: Postgres Cluster on Solaris Previous: From: Achilleas Mantzios Date: 2008-05-12 15:01:34 Subject: Re: how to get a number of seconds in some interval ?