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