(9.1) btree_gist support for searching on "not equals" - Mailing list pgsql-hackers

From Jeff Davis
Subject (9.1) btree_gist support for searching on "not equals"
Date
Msg-id 1274474857.27379.101.camel@jdavis-laptop
Whole thread Raw
Responses Re: (9.1) btree_gist support for searching on "not equals"
List pgsql-hackers
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


Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: unnailing shared relations (was Re: global temporary tables)
Next
From: Josh Berkus
Date:
Subject: Idea for getting rid of VACUUM FREEZE on cold pages