On Sat, Jan 2, 2010 at 1:37 PM, hubert depesz lubaczewski
<dep...@depesz.com> wrote:
>    CONSTRAINT overlapping_times EXCLUDE USING GIST (
>        box(
>            point( extract(epoch FROM from_ts at time zone 'UTC'), 
> extract(epoch FROM from_ts at time zone 'UTC') ),
>            point( extract(epoch FROM to_ts at time zone 'UTC')  , 
> extract(epoch FROM to_ts at time zone 'UTC') )
>        ) WITH &&
>

Hm, this would be easier to write as:

CONSTRAINT overlapping_times EXCLUDE USING GIST (
  tinterval(from_ts::abstime, to_ts::abstime) WITH &&

But that still seems a bit more complex than ideal. Would it be
reasonable to have a tinterval() constructor which takes timestamptz
data types? Then you could just write

CONSTRAINT overlapping_times
  EXCLUDE USING GIST (tinterval(from_ts, to_ts)) USING &&


-- 
greg

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to