Re: Range-Types in 9.2 - Mailing list pgsql-general

From Jeff Davis
Subject Re: Range-Types in 9.2
Date
Msg-id 1344275508.4357.12.camel@jdavis
Whole thread Raw
In response to Re: Range-Types in 9.2  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Range-Types in 9.2
Re: Range-Types in 9.2
List pgsql-general
On Fri, 2012-08-03 at 10:42 -0700, Jeff Davis wrote:
> On Fri, 2012-08-03 at 17:06 +0200, Andreas Kretschmer wrote:
> > great feature, but i can't find a TIMERANGE, i want to store time-ranges, for
> > instance [10:00:00,16:00:00), how can i do that?
>
> CREATE TYPE timerange AS RANGE ( subtype = time );
>
> That's the simple answer. I believe we discussed including this as a
> built-in range type at some point, but decided against it. I can't
> remember the reason right now.

Time of day is a cycle (I forget who pointed this out), so a limit of
24:00:00 is fairly restrictive. It happens that daytime ranges like
[14:00,15:00) are more common; but it doesn't seem unreasonable to say
[22:00,02:00) either.

So, an interpretation where time of day has a total order is only useful
really for a daytime schedule (which is still useful, but perhaps not
general enough to include in core). We might be able to make it work as
ranges within a 24-hour cycle, but that will require more thought.

Regards,
    Jeff Davis


pgsql-general by date:

Previous
From: David Salisbury
Date:
Subject: Re: Hi,Frirends, are there any commands in pgsql/bin/ corresponding "create tablespace"?
Next
From: "David Johnston"
Date:
Subject: Re: Range-Types in 9.2