Re: operator suggest " interval / interval = numeric" - Mailing list pgsql-hackers

From Brendan Jurd
Subject Re: operator suggest " interval / interval = numeric"
Date
Msg-id 37ed240d0801092033j675c4113s79a0de3968e67c8b@mail.gmail.com
Whole thread Raw
In response to Re: operator suggest " interval / interval = numeric"  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: operator suggest " interval / interval = numeric"  ("Warren Turkal" <wturkal@gmail.com>)
Re: operator suggest " interval / interval = numeric"  ("Brendan Jurd" <direvus@gmail.com>)
Re: operator suggest " interval / interval = numeric"  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Jan 10, 2008 2:17 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> You'd have to define exactly what that means, which seems a little
> tricky for incommensurate intervals.  For instance what is the
> result of '1 month' / '1 day' ?
>

Postgres has already made such definitions, to allow direct
interval-interval comparison.

1 month is deemed equal to 30 days, 1 day is deemed equal to 24 hours
(although for some reason we ignore the issue of years vs. days).

I argued in a long-dead thread that we should disallow these kinds of
comparisons altogether, but I didn't manage to generate much
enthusiasm.  The overall sentiment seemed to be that the slightly
bogus results were more useful than no result at all.

That being the case, if we're comfortable making these kinds of
arbitrary definitions for comparison purposes, it doesn't seem like
much of a stretch to allow multiplication and division of intervals
using the same rules.

Regards,
BJ


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: operator suggest " interval / interval = numeric"
Next
From: "Warren Turkal"
Date:
Subject: Re: operator suggest " interval / interval = numeric"