Re: Procedure for feature requests? - Mailing list pgsql-general

From Tim Landscheidt
Subject Re: Procedure for feature requests?
Date
Msg-id m3vdi07jng.fsf@passepartout.tim-landscheidt.de
Whole thread Raw
In response to Procedure for feature requests?  (Tim Landscheidt <tim@tim-landscheidt.de>)
Responses Re: Procedure for feature requests?
List pgsql-general
Sam Mason <sam@samason.me.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

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: auto truncate/vacuum full
Next
From: Pavel Stehule
Date:
Subject: Re: Upgrade from 8.2 to 8.3 & catching errors in functions