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

Re: minimum operators for b-tree, r-tree

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: elein <elein(at)varlena(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: minimum operators for b-tree, r-tree
Date: 2004-06-30 14:32:56
Message-ID: 8607.1088605976@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
elein <elein(at)varlena(dot)com> writes:
> When creating a new data type, what are
> the operators absolutely necessary for that
> type to particpate in a btree index?

You must supply all the operators described in the standard strategy
set:
http://www.postgresql.org/docs/7.4/static/xindex.html#XINDEX-STRATEGIES
plus the support function(s):
http://www.postgresql.org/docs/7.4/static/xindex.html#XINDEX-SUPPORT

The system is not designed to cope with an incomplete opclass, and I'm
not sure it would work if you tried.

BTW, although <> isn't part of a btree opclass it is a good idea to
provide it (and link it to the opclass by making it the negator of =).
There's at least one place in the system that knows about using this.

The way I prefer to handle this stuff for btree is to write a single
three-way comparison function (compare a to b, return +1/0/-1).  This
can be used directly as the btree support function, and then the six
comparison-operator functions are one-line wrappers around it.

			regards, tom lane

In response to

pgsql-general by date

Next:From: Bruno Wolff IIIDate: 2004-06-30 14:35:41
Subject: Re: DML Restriction unless through a function
Previous:From: Adam WitneyDate: 2004-06-30 14:02:33
Subject: Re: DML Restriction unless through a function

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