Re: Procedure for feature requests?

From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Procedure for feature requests?
Date: 2009-10-27 18:53:55
Message-ID: m3vdi07jng.fsf@passepartout.tim-landscheidt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sam Mason <sam(at)samason(dot)me(dot)uk> wrote:

>> > any definition of "division" I've ever been able to think of [is]
>> > ill defined

>> Yep, you would probably need some safety margin and add a
>> "WHERE" clause. I should have thought about that earlier as
>> I recently stumbled (again) over why "INTERVAL / INTERVAL"
>> was not defined.

> Not sure what you mean by a "safety margin", but I don't think it would
> help much. Hours are defined using seconds (they're *always* 3600
> seconds long, but, say, a day isn't *always* 24 hours long) so I don't
> see what a safety margin would do.

A month can last 28 to 31 days and a year 365 to 366 days,
but for example:

| tim=# SELECT EXTRACT('epoch' FROM '1 month'::INTERVAL) / 60.0 / 60 / 24;
| ?column?
| ----------
| 30
| (1 Zeile)

| tim=#

You would have to adjust the result of "(EXTRACT('epoch'
FROM B) - EXTRACT('epoch' FROM A)) / EXTRACT('epoch' FROM
C)" by a factor of 31/30 (30/28? 28/30?) and then chop off
timestamps after B with a "WHERE" clause.

JFTR: Hours can of course also be 3601 (or theoretically
3599) seconds long, but not in PostgreSQL :-).

Tim

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2009-10-27 18:57:52 Re: Upgrade from 8.2 to 8.3 & catching errors in functions
Previous Message Alvaro Herrera 2009-10-27 17:31:45 Re: auto truncate/vacuum full