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

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>
Cc: pgsql-hackers@postgresql.org, Oleg Bartunov <oleg@sai.msu.su>, Teodor Sigaev <teodor@sigaev.ru>
Date: 2010-05-25T03:25:18Z
Lists: pgsql-hackers
On Sat, 2010-05-22 at 01:02 +0300, Marko Tiikkaja wrote:
> On 5/21/10 11:47 PM +0300, Jeff Davis wrote:
> > 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)
> >    );
> 
> FWIW, this is achievable a lot more easily:
> CREATE UNIQUE INDEX "a_single_row" ON a ((1));
> 

Yes, you're right. Also, neither of us accounted for NULLs, so I suppose
a NOT NULL is necessary as well.

I think the original case (same values only) is potentially useful
enough that we should support it.

Regards,
	Jeff Davis