This patch adds support to btree_gist for searching on <> ("not
equals").
This allows an interesting use of exclusion constraints:
Say you have a table:
create table zoo
(
cage int,
animal text,
exclude using gist (cage with =, animal with <>)
);
That will permit you to add as many zebras as you want to a given cage,
and as many lions as you want to another cage, but will not allow you to
mix zebras and lions in the same cage.
It also allows you to enforce the constraint that only one tuple exists
in a table by doing something like:
create table a
(
i int,
exclude using gist (i with <>),
unique (i)
);
Regards,
Jeff Davis