Обсуждение: GiST: range of penalty method?

Поиск
Список
Период
Сортировка

GiST: range of penalty method?

От
Neil Conway
Дата:
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


Вложения