From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | depesz(at)depesz(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Error in exclusion constraint error message (8.5)? |
Date: | 2010-01-02 18:37:06 |
Message-ID: | 407d949e1001021037g7427eef0x5392f655698245a5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, Jan 2, 2010 at 1:37 PM, hubert depesz lubaczewski
<depesz(at)depesz(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-01-02 19:23:00 | Re: Error in exclusion constraint error message (8.5)? |
Previous Message | Tom Lane | 2010-01-02 17:55:01 | Re: Error in exclusion constraint error message (8.5)? |