Re: operator suggest " interval / interval = numeric"

From: "Brendan Jurd" <direvus(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ilya А(dot) Кovalenko <shadow(at)oganer(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: operator suggest " interval / interval = numeric"
Date: 2008-01-10 04:33:25
Message-ID: 37ed240d0801092033j675c4113s79a0de3968e67c8b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jan 10, 2008 2:17 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Warren Turkal 2008-01-10 05:15:03 Re: operator suggest " interval / interval = numeric"
Previous Message Alvaro Herrera 2008-01-10 03:42:23 Re: operator suggest " interval / interval = numeric"