Re: operator classes for index?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: operator classes for index?
Дата
Msg-id 22626.1303773322@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: operator classes for index?  (Yves Weißig <weissig@rbg.informatik.tu-darmstadt.de>)
Ответы Re: operator classes for index?  (Yves Weißig <weissig@rbg.informatik.tu-darmstadt.de>)
Список pgsql-hackers
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.

> 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


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: wrong hint message for ALTER FOREIGN TABLE
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: branching for 9.2devel