Skip site navigation (1) Skip section navigation (2)

(9.1) btree_gist support for searching on "not equals"

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Teodor Sigaev <teodor(at)sigaev(dot)ru>
Subject: (9.1) btree_gist support for searching on "not equals"
Date: 2010-05-21 20:47:36
Message-ID: 1274474857.27379.101.camel@jdavis-laptop (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
This patch adds support to btree_gist for searching on <> ("not

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)

	Jeff Davis

Attachment: btree-gist-ne.patch
Description: text/x-patch (7.7 KB)


pgsql-hackers by date

Next:From: Jan WieckDate: 2010-05-21 21:05:10
Subject: Re: Specification for Trusted PLs?
Previous:From: Joshua TolleyDate: 2010-05-21 20:21:40
Subject: Re: Specification for Trusted PLs?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group