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

From Scott Bailey
Subject Re: Range-Types in 9.2
Date
Msg-id 501D819D.7020506@gmail.com
Whole thread Raw
In response to Range-Types in 9.2  (Andreas Kretschmer <andreas@a-kretschmer.de>)
List pgsql-general
On 08/03/2012 08:06 AM, Andreas Kretschmer wrote:
>
> Hi all,
> 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?
>
>
>
> Regards, Andreas

Time ranges could be more complicated than you realize. You'd have
problems if you wanted to create a range that extends beyond midnight.
Say for example, you need a range from 10 PM to 4 AM. We realize it as
being 4AM the following day, But if you tried to enter it into a time
range, it would throw an exception for having an upper bound smaller
than the lower bounds.

You might have to use something like int4range to represent minutes or
seconds of the day and add some helper functions. So for minutes you'd
represent 10 PM to 4 AM as [1320, 1680)


pgsql-general by date:

Previous
From: Menelaos PerdikeasSemantix
Date:
Subject: maximum number of databases and / or schemas in a single database instance
Next
From: "Mary F. Masterson"
Date:
Subject: Pgadmin3 v1.14.2 foreign keys