pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Achilleas Mantzios <achill@matrix.gatewaynet.com>
Cc: Julius Tuskenis <julius@nsoft.lt>
Cc: pgsql-admin@postgresql.org
Subject: Re: how to get a number of seconds in some interval ?
Date: Mon, 12 May 2008 11:09:11 -0400
Message-ID: <20080.1210604951@sss.pgh.pa.us> (raw)
In-Reply-To: <200805121801.35101.achill@matrix.gatewaynet.com>
References: <482849B0.6050103@nsoft.lt>
	<200805121724.38772.achill@matrix.gatewaynet.com>
	<48285507.4010007@nsoft.lt>
	<200805121801.35101.achill@matrix.gatewaynet.com>

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



view thread (11+ messages)  latest in thread

Message-ID: <20080.1210604951@sss.pgh.pa.us>
Permalink:  ../20080.1210604951@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20080.1210604951@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, achill@matrix.gatewaynet.com, julius@nsoft.lt
  Subject: Re: how to get a number of seconds in some interval ?
  In-Reply-To: <20080.1210604951@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox