Re: Error in exclusion constraint error message (8.5)? - Mailing list pgsql-bugs

From Greg Stark
Subject Re: Error in exclusion constraint error message (8.5)?
Date
Msg-id 407d949e1001021037g7427eef0x5392f655698245a5@mail.gmail.com
Whole thread Raw
In response to Error in exclusion constraint error message (8.5)?  (hubert depesz lubaczewski <depesz@depesz.com>)
Responses Re: Error in exclusion constraint error message (8.5)?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Sat, Jan 2, 2010 at 1:37 PM, hubert depesz lubaczewski
<depesz@depesz.com> wrote:
> =A0 =A0CONSTRAINT overlapping_times EXCLUDE USING GIST (
> =A0 =A0 =A0 =A0box(
> =A0 =A0 =A0 =A0 =A0 =A0point( extract(epoch FROM from_ts at time zone 'UT=
C'), extract(epoch FROM from_ts at time zone 'UTC') ),
> =A0 =A0 =A0 =A0 =A0 =A0point( extract(epoch FROM to_ts at time zone 'UTC'=
) =A0, extract(epoch FROM to_ts at time zone 'UTC') )
> =A0 =A0 =A0 =A0) 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 &&


--=20
greg

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Error in exclusion constraint error message (8.5)?
Next
From: Tom Lane
Date:
Subject: Re: Error in exclusion constraint error message (8.5)?