Re: Using constraint exclusion with 2 floats

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using constraint exclusion with 2 floats
Date: 2011-10-17 10:40:36
Message-ID: CA+U5nM+XOqCinP4Sipcyw+7mTeCvNGq6ta60jbeyRHD_8zTazg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 12, 2011 at 10:40 PM, Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
> Thank you for your answer.
>
> I'm sorry I really didn't explained well my problem :/
>
> For example if I have a table test like this :
> CREATE TABLE test (min real not null, max real not null, desc character
> varying not null);
>
> and I want a constraint exclusion to make sure the range min/max doens't
> overlap
>
> I can't write ALTER TABLE test add constraint test_exclude EXCLUDE USING
> btree ((min,max) WITH &&)
>
> I saw the extension temporal gives a new type PERIOD and has operators like
> &&, but only for timestamp, so I'm wondering if I must code something
> something similar or if there's is an easier way

You've confused "exclusion constraints" with "constraint exclusion",
which does seem easy to do.

"Exclusion constraints" are not limited to a single datatype either,
so you should be able to find a solution.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2011-10-17 13:20:36 Re: plpgsql; execute query inside exists
Previous Message jozsef.kurucz 2011-10-17 07:32:15 plpgsql; execute query inside exists