Re: Inserting Values into Interval - Mailing list pgsql-general

From Tom Lane
Subject Re: Inserting Values into Interval
Date
Msg-id 3933.1245714037@sss.pgh.pa.us
Whole thread Raw
In response to Inserting Values into Interval  (BlackMage <dsd7872@uncw.edu>)
Responses Re: Inserting Values into Interval
List pgsql-general
BlackMage <dsd7872@uncw.edu> writes:
> I am having a small issue when entering values into the interval field. Say
> I want to enter a time of 2:03, two minutes and 3 seconds. When I insert
> that into an interval field, it comes up at 02:03:00, 2 hours, 3 minutes.
> The only way I've gotten around this so far is by doing 00:02:03. But I was
> wondering if there is another of inserting into an interval field where the
> values will start at the lower end first, so the result will be 00:02:03
> when 2:03 is inserted?

In 8.4 it'll be possible to do that by declaring the interval as MINUTE
TO SECOND, but there's no way around it in existing releases.  I'm not
sure I'd care to rely on that anyway, because any time you provide an
interval value that isn't *immediately* tied to a MINUTE TO SECOND
qualifier, it's going to get interpreted in the more standard way.
I think you'd be happier in the long run if you avoid depending on such
an ambiguous data format.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Slight change in query leads to unexpected change in query plan
Next
From: Andrew Maclean
Date:
Subject: Hourly dates