Re: [GENERAL] Exclusion constraint issue

2010-09-28 Thread Eric McKeeth
On Tue, Sep 28, 2010 at 4:07 PM, Jeff Davis wrote: > On Tue, 2010-09-28 at 12:18 -0600, Eric McKeeth wrote: > > > This is ugly, but it does seem to enforce the constraint I need, of > > non-overlapping dates where sharing an endpoint is not considered an > > overlap. > > The period type supports

Re: [GENERAL] Exclusion constraint issue

2010-09-28 Thread Jeff Davis
On Tue, 2010-09-28 at 12:18 -0600, Eric McKeeth wrote: > This is ugly, but it does seem to enforce the constraint I need, of > non-overlapping dates where sharing an endpoint is not considered an > overlap. The period type supports different inclusivity/exclusivity combinations. So, the period:

Re: [GENERAL] Exclusion constraint issue

2010-09-28 Thread Eric McKeeth
On Fri, Sep 24, 2010 at 3:22 PM, Tom Lane wrote: > Eric McKeeth writes: > > why would I get the following error, since the period() function is in > fact > > declared as immutable? > > > test=# ALTER TABLE test3 ADD exclude using > > gist(period(effect_date::timestamptz, expire_date::timestamptz

Re: [GENERAL] Exclusion constraint issue

2010-09-26 Thread David Fetter
On Sun, Sep 26, 2010 at 10:15:00AM -0400, Tom Lane wrote: > David Fetter writes: > > On Fri, Sep 24, 2010 at 05:22:15PM -0400, Tom Lane wrote: > >> period() might be immutable, but those casts from date to > >> timestamptz are not, because they depend on the TimeZone > >> parameter. > > > How har

Re: [GENERAL] Exclusion constraint issue

2010-09-26 Thread Tom Lane
David Fetter writes: > On Fri, Sep 24, 2010 at 05:22:15PM -0400, Tom Lane wrote: >> period() might be immutable, but those casts from date to >> timestamptz are not, because they depend on the TimeZone parameter. > How hard would it be to point out the first expression found to be > mutable? I l

Re: [GENERAL] Exclusion constraint issue

2010-09-26 Thread David Fetter
On Fri, Sep 24, 2010 at 05:22:15PM -0400, Tom Lane wrote: > Eric McKeeth writes: > > why would I get the following error, since the period() function > > is in fact declared as immutable? > > > test=# ALTER TABLE test3 ADD exclude using > > gist(period(effect_date::timestamptz, expire_date::times

Re: [GENERAL] Exclusion constraint issue

2010-09-24 Thread Tom Lane
Eric McKeeth writes: > why would I get the following error, since the period() function is in fact > declared as immutable? > test=# ALTER TABLE test3 ADD exclude using > gist(period(effect_date::timestamptz, expire_date::timestamptz) with && ); > ERROR: functions in index expression must be mar