Re: operator classes for index?

From: Yves Weißig <weissig(at)rbg(dot)informatik(dot)tu-darmstadt(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: operator classes for index?
Date: 2011-04-25 20:47:18
Message-ID: 4DB5DDD6.7020504@rbg.informatik.tu-darmstadt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Am 24.04.2011 23:33, schrieb Tom Lane:
> =?ISO-8859-15?Q?Yves_Wei=DFig?= <weissig(at)rbg(dot)informatik(dot)tu-darmstadt(dot)de> writes:
>> again index access methods, can somebody shed some light into operator
>> classes for indexes? The documentation is an entry point, but after
>> reading I still don't have a clue how exactly they are used and created?
>> Perhaps somebody with great knowledge can supply an 101 on opeartor
>> classes? Because I keep getting the hint: You must specify an operator
>> class for the index or define a default operator class for the data type.
>
> Have you read
> http://developer.postgresql.org/pgdocs/postgres/indexes-opclass.html
> http://developer.postgresql.org/pgdocs/postgres/xindex.html
> and the reference pages for CREATE OPERATOR CLASS/FAMILY?

Thanks Tom, those links helped me understanding! Especially the contrib
modules served as good examples.
But anyway I am having trouble creating an operator class:

CREATE OPERATOR CLASS abstime_ops
DEFAULT FOR TYPE abstime USING ebi FAMILY abstime_ops AS
OPERATOR 1 = ,
FUNCTION 1 abstimeeq(abstime,abstime);

yields: ERROR: invalid procedure number 1, must be between 1 and 0
SQL Status:42P17
I couldn't find additional information to the error via google, what is
wrong with the create statement?

Additional, I don't know yet how to create index method support
routines. I want to re-use the hash functions from hashfunc.c (because I
do kind of a mapping). Is this possible? How does index_getprocinfo();
now which support routine belongs to my index?

>
> If it's still not coming together for you, there are numerous examples
> of creating operator classes in the contrib modules. The GIST and GIN
> documentation might be relevant as well:
> http://developer.postgresql.org/pgdocs/postgres/gist.html
> http://developer.postgresql.org/pgdocs/postgres/gin.html
>
> regards, tom lane
>

Greetz, Yves

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2011-04-25 20:55:33 Re: branching for 9.2devel
Previous Message Robert Haas 2011-04-25 20:42:11 Re: Foreign table permissions and cloning