Skip site navigation (1) Skip section navigation (2)

Re: Error in exclusion constraint error message (8.5)?

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 (view raw or flat)
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

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2010-01-02 19:23:00
Subject: Re: Error in exclusion constraint error message (8.5)?
Previous:From: Tom LaneDate: 2010-01-02 17:55:01
Subject: Re: Error in exclusion constraint error message (8.5)?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group