Exclusion constraint with negated operator? - Mailing list pgsql-general

From Torsten Förtsch
Subject Exclusion constraint with negated operator?
Date
Msg-id CAKkG4_=4Wo43KfFNE1i_91p+xJnGry_WM8fngH8Tv=F5wBD=wA@mail.gmail.com
Whole thread Raw
Responses Re: Exclusion constraint with negated operator?
List pgsql-general
Hi,

I wanted to create an exclusion constraint like

EXCLUDE (c1 WITH =, c2 with <>)

This gives an error:

operator <>(integer,integer) is not a member of operator family "integer_ops"

I can resolve that by using gist and the btree_gist extension.

My question is can I somehow express something like

EXCLUDE (c1 WITH =, c2 with NOT =)

It seems that's not possible at the moment. But is there any obstacle in principle or is it just not implemented?

We have a ton of overlap operators (geometric, ranges, arrays) but none for the opposite. Sometimes that's useful for exclusion constraints.

Thanks,
Torsten

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Reproducing incorrect order with order by in a subquery
Next
From: "Patrick O'Toole"
Date:
Subject: Helping planner to chose sequential scan when it improves performance