Re: Broken(?) 'interval' problems. [Was: ISO 8601 "Time Intervals"]

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Ron Mayer <ron(at)intervideo(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Broken(?) 'interval' problems. [Was: ISO 8601 "Time Intervals"]
Date: 2003-09-11 00:21:19
Message-ID: 20030911002119.GA976@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 10, 2003 at 15:43:56 -0700,
Ron Mayer <ron(at)intervideo(dot)com> wrote:
> Bruno wrote:
> >
> > Can you document which part of a mixed interval (with both months and
> > seconds parts) gets added first to a timestamp? I haven't ever run
> > across anything which says which gets done first.
> >
>
> In the existing code, the sql spec, or the proposed implementation?

In whatever is going to get implemented.

> In the existing code, I think everything with "+" gets done
> in in the same order (left-to-right?), regardless of if the
> fields are timestamps or intervals.

That isn't what I was asking about. An interval has two parts. One
part is the number of months in the interval and the other part is
the number of seconds (or perhaps milliseconds). Often a single interval
will only have one of these parts be nonzero. However if both parts are
nonzero it makes a difference in which part gets added first.
For example '2003-02-28'::date + '1 month 1 day'::interval might
be either 2003-03-29 or 2003-04-01. In 7.4 it is currently 2003-03-29,
but since it isn't documented it isn't clear if that will be true
in future versions.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Yarra 2003-09-11 00:56:20 Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)
Previous Message Andrew Dunstan 2003-09-10 23:57:24 Re: massive quotes?