Re: interval / interval -> double operator - Mailing list pgsql-hackers

From Andrew Hammond
Subject Re: interval / interval -> double operator
Date
Msg-id 5a0a9d6f0705180104y591c4190pef81b89d2e0bc756@mail.gmail.com
Whole thread Raw
In response to Re: interval / interval -> double operator  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: interval / interval -> double operator
List pgsql-hackers
On 5/17/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Andrew Hammond" <andrew.george.hammond@gmail.com> writes:
> On 5/17/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> What are the grounds for defining it that way rather than some other
>> way?

> The only alternative that came to mind when I wrote it was using a numeric
> instead of float.

No, I'm wondering what's the justification for smashing it to a single
number at all, when the inputs are three-field values.  Interval divided
by float doesn't produce just a float, for example.


I think I see what you're getting at here. '1 month' / '1 day' could return a number of reasonable values depending on how many days are in the month (28 to 31) and on how many hours are in a day (generally 24, but can be 23 or 25 for DST adjustments). The definition above simply assumes that EXTRACT(epoch...) does the Right Thing. Hmmm. I'm at a loss for the right way to solve this. It seems very reasonable to want to divide intervals by intervals (how many nanocenturies in a fortnight?), but I'm at a loss for how to do that correctly. I'll read the code from EXTRACT(epoch...) and see what happening there.

Andrew

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: What is happening on buildfarm member baiji?
Next
From: "Simon Riggs"
Date:
Subject: Re: pg_standby question (solved)