Thread: Using constraint exclusion with 2 floats
Hi everyone,
Is there an easy way (that I maybe missed) to use constraint exclusion with 2 floats ?
Must I find an extension the temporal extension which create a new type with 2 timestamp or can I usethe && operator with 2 fields ?
Thank you
Is there an easy way (that I maybe missed) to use constraint exclusion with 2 floats ?
Must I find an extension the temporal extension which create a new type with 2 timestamp or can I usethe && operator with 2 fields ?
Thank you
On Wed, Oct 12, 2011 at 10:16 AM, Julien Rouhaud <rjuju123@gmail.com> wrote: > Hi everyone, > Is there an easy way (that I maybe missed) to use constraint exclusion with > 2 floats ? > Must I find an extension the temporal extension which create a new type with > 2 timestamp or can I usethe && operator with 2 fields ? There's nothing in constraint exclusion that depends upon specific datatypes. Let us know if you find a problem with floats. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
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
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
On Wed, Oct 12, 2011 at 11:23 PM, Simon Riggs <simon@2ndquadrant.com> wrote:
There's nothing in constraint exclusion that depends upon specific datatypes.On Wed, Oct 12, 2011 at 10:16 AM, Julien Rouhaud <rjuju123@gmail.com> wrote:
> Hi everyone,
> Is there an easy way (that I maybe missed) to use constraint exclusion with
> 2 floats ?
> Must I find an extension the temporal extension which create a new type with
> 2 timestamp or can I usethe && operator with 2 fields ?
Let us know if you find a problem with floats.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
On Wed, Oct 12, 2011 at 10:40 PM, Julien Rouhaud <rjuju123@gmail.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