Re: Range-Types in 9.2

From: Scott Bailey <artacus72(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Range-Types in 9.2
Date: 2012-08-04 20:10:05
Message-ID: 501D819D.7020506@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mary F. Masterson 2012-08-04 20:10:59 Pgadmin3 v1.14.2 foreign keys
Previous Message Menelaos PerdikeasSemantix 2012-08-04 19:24:07 maximum number of databases and / or schemas in a single database instance