Re: operator classes for index?

Поиск
Список
Период
Сортировка
От Yves Weißig
Тема Re: operator classes for index?
Дата
Msg-id 4DB68DD1.8030005@rbg.informatik.tu-darmstadt.de
обсуждение исходный текст
Ответ на Re: operator classes for index?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: operator classes for index?  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Am 26.04.2011 01:15, schrieb Tom Lane:
> Yves Weißig <weissig@rbg.informatik.tu-darmstadt.de> writes:
>> 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
> 
> Apparently you've got zero in pg_am.amsupport for your new index AM.
> You need to set that to the number of support-procedure types your AM
> defines.  Have you been through
> http://developer.postgresql.org/pgdocs/postgres/indexam.html
> and the docs and source code for the pg_am, pg_amop, pg_amproc catalogs?
> See
> http://developer.postgresql.org/pgdocs/postgres/catalogs.html
> as well as the src/include/catalog/ files for those catalogs.
> 
>> 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?
> 
> Just list them in your CREATE OPERATOR CLASS commands.

Alright, now I starting to get the point.
Still I have a problem, when I am trying to execute

CREATE OPERATOR CLASS abstime_opsDEFAULT FOR TYPE abstime USING ebi FAMILY abstime_ops ASOPERATOR 1 =
(abstime,abstime),FUNCTION1 hashint4(abstime,abstime);
 

it yields: ERROR:  function hashint4(abstime, abstime) does not exist
though it exists (it is part of the hash AM), do I have to note the
namespace or something else? pg_proc has a row for hashint4, but of
course with different parameter types, int4 namely. Where do I cast
them? Or is a implict conversion performed?

Thanks again!

> 
>> How does index_getprocinfo();
>> now which support routine belongs to my index?
> 
> It looks in pg_amproc to find the routines that are entered for the
> opclass associated with the index.  This is a pretty direct
> representation of the FUNCTION entries from your previous CREATE
> OPERATOR CLASS (or if you prefer, CREATE OPERATOR CLASS is designed to
> provide the information needed to populate pg_amop and pg_amproc).
> 
>             regards, tom lane
> 

Greetz, Yves


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alexander Korotkov
Дата:
Сообщение: Re: GSoC 2011: Fast GiST index build
Следующее
От: Radosław Smogura
Дата:
Сообщение: Re: Improving the memory allocator