Re: GiST indexing question - Mailing list pgsql-general
From | Yeb Havinga |
---|---|
Subject | Re: GiST indexing question |
Date | |
Msg-id | 4D038651.6030007@gmail.com Whole thread Raw |
In response to | GiST indexing question (Greg Landrum <greg.landrum@gmail.com>) |
Responses |
Re: GiST indexing question
|
List | pgsql-general |
On 2010-12-11 06:09, Greg Landrum wrote: > I'm now trying to add an equality operator (==) as follows: > > CREATE OPERATOR == ( > LEFTARG = mol, > RIGHTARG = mol, > PROCEDURE = mol_eq, > COMMUTATOR = '=', > NEGATOR = '<>', > RESTRICT = eqsel, > JOIN = eqjoinsel > ); Are you sure the commutator and negator exist and are correct? > and I want to use this to extend the operator class: > > CREATE OPERATOR CLASS mol_ops > DEFAULT FOR TYPE mol USING gist > AS > OPERATOR 3 @> (mol, mol), > OPERATOR 4 <@ (mol, mol), > OPERATOR 6 == (mol, mol), > FUNCTION 1 gmol_consistent (bytea, internal, int4), > FUNCTION 2 gmol_union (bytea, internal), > FUNCTION 3 gmol_compress (internal), > FUNCTION 4 gmol_decompress (internal), > FUNCTION 5 gmol_penalty (internal, internal, internal), > FUNCTION 6 gmol_picksplit (internal, internal), > FUNCTION 7 gmol_same (bytea, bytea, internal), > STORAGE bytea; This seems to be ok. > But when I actually run a query I get an error: > > moltest=# select count(*) from mols where m=='c1ncnnc1'; > ERROR: Unknown strategy: 6 I could not find that error exact message in the code, but something similar gave a hit. $ grep -r 'Unknown strategy' * $ grep -ri 'Unknown strategy' * contrib/intarray/_int_gin.c: elog(ERROR, "ginint4_consistent: unknown strategy number: %d", src/backend/access/gin/ginarrayproc.c: elog(ERROR, "ginarrayconsistent: unknown strategy number: %d", src/backend/access/gist/gistproc.c: elog(ERROR, "unknown strategy number: %d", strategy); src/backend/access/gist/gistproc.c: elog(ERROR, "unknown strategy number: %d", strategy); both the gistproc hits are in built-in consistent functions. This makes me believe that the error might be thrown in the rdkit's mol consistent function. > I guess I must be doing something stupid, but neither the docs nor the > internet have been particularly helpful in letting me know what. Yeah, a hint might help for that error message. But since it doesn't, a quick way for problems like this is to increase log_error_verbosity to verbose, trigger the error again. Then the sourcefile and linenumber are logged as well. If it is then still unclear what's causing the error, you can use that information in gdb to set a breakpoint on that source location. > In case it's helpful, the full extension code (without the > non-functioning attempts at adding == to the index) is here: > http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/PgSQL/rdkit/ If you take a look at http://rdkit.svn.sourceforge.net/viewvc/rdkit/trunk/Code/PgSQL/rdkit/rdkit_gist.c?revision=1481&view=markup and then line 651: that's the error being thrown. You need to extend gmol_consistent to handle the strategy 6 number. regards, Yeb Havinga
pgsql-general by date: