Does anyone know what the expected range of the "penalty" GiST method is? (i.e. Is the legal range documented anywhere? Failing that, what does existing GiST-based code expect?)
While rewriting gistchoose() in gist.c to be less obfuscated, it occurred to me that (a) I don't think the existing code will work as intended if a negative penalty is returned (b) it would be good to define a "minimum legal penalty". Once the minimum penalty has been returned for a particular location, GiST can know that all other locations where it might insert the node will have a penalty greater than or equal to that value, so gistchoose() can bail-out earlier. Therefore, I'd like to make "0.0" is the minimum legal penalty, and require all GiST "penalty" methods to return values >= 0. I think requiring the penalty != NaN would also be a good idea. Comments? Note that making this change to CVS tip results in a regression failure in contrib/btree_gist. The regression.diffs are attached. The regression tests for rtree_gist, tsearch, tsearch2 and pg_trgm succeed after making the modification. -Neil
*** ./expected/bit.out 2004-11-09 11:20:51 +11:00 --- ./results/bit.out 2004-11-10 15:44:52 +11:00 *************** *** 33,38 **** --- 33,39 ---- (1 row) CREATE INDEX bitidx ON bittmp USING GIST ( a ); + ERROR: illegal penalty from GiST penalty method: -116307439489975337053247905800904507392.000000 SET enable_seqscan=off; SELECT count(*) FROM bittmp WHERE a < '011011000100010111011000110000100'; count ====================================================================== *** ./expected/varbit.out 2004-11-09 11:20:51 +11:00 --- ./results/varbit.out 2004-11-10 15:44:52 +11:00 *************** *** 33,38 **** --- 33,39 ---- (1 row) CREATE INDEX varbitidx ON varbittmp USING GIST ( a ); + ERROR: illegal penalty from GiST penalty method: -92381335565846851340979378715858305024.000000 SET enable_seqscan=off; SELECT count(*) FROM varbittmp WHERE a < '1110100111010'::varbit; count ======================================================================
---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]