Am 26.04.2011 01:15, schrieb Tom Lane: > =?ISO-8859-15?Q?Yves_Wei=DFig?= <weis...@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_ops DEFAULT FOR TYPE abstime USING ebi FAMILY abstime_ops AS OPERATOR 1 = (abstime,abstime), FUNCTION 1 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers