Am 24.04.2011 23:33, schrieb Tom Lane:
> Yves Weißig <weissig@rbg.informatik.tu-darmstadt.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_opsDEFAULT FOR TYPE abstime USING ebi FAMILY abstime_ops ASOPERATOR 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