Re: operator suggest " interval / interval = numeric"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Brendan Jurd" <direvus(at)gmail(dot)com>
Cc: "Warren Turkal" <wturkal(at)gmail(dot)com>, 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 07:06:19
Message-ID: 26996.1199948779@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Brendan Jurd" <direvus(at)gmail(dot)com> writes:
> On Jan 10, 2008 5:00 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> The spec's approach to datetime operations in general is almost totally
>> brain-dead, ...

> It's true that the spec fails to consider DST, in that it doesn't
> partition "day" and "second" intervals separately.

That's only one of the ways in which they ignore DST, and not even the
most important one --- my vote for the spectacularly bad omission is
that SET TIME ZONE only allows constant offsets from UTC.

> Whether the spec is braindead w.r.t intervals or not, Postgres is
> clearly giving the wrong answer.

Sure, but it's not clear that there *is* a right answer. As noted
upthread, a useful approximate answer can be better than no answer
at all.

> None of these comparisons are sane.

You can always refrain from making such comparisons, if you think they
are incapable of yielding useful answers.

This whole area is pretty messy, and I don't think that there is or can
be a simple uniform solution :-(. We need to tread carefully in
introducing new behaviors that we might regret later. So I'm not in
favor of inventing an interval division operator that just duplicates
functionality that's already there in a more-cumbersome notation.
We might want that operator back someday. Who even wants to argue that
the result datatype should be numeric? Dividing a three-component
quantity by another one doesn't sound to me like an operation that
naturally yields a scalar result.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Warren Turkal 2008-01-10 07:06:30 Re: operator suggest " interval / interval = numeric"
Previous Message Brendan Jurd 2008-01-10 06:44:35 Re: operator suggest " interval / interval = numeric"