Jeff Hoffmann <jeff@remapcorp.com> writes:
> has something changed with r-tree indexes in 6.5?
> ERROR: Operator 500 must have a restriction selectivity estimator to be
> used in a btree index
What we have here is a big OOOPS.
The reference to "btree" is coming from btreesel, which it turns out is
called by rtreesel as well --- I missed that the first time around.
But that's just a cosmetic problem in the error message. The real
problem is that none of the operators that are used for rtree indexes
have restriction selectivity estimators.
They *used* to have selectivity estimators in 6.4.2 --- they all pointed
at intltsel, which is pretty much completely inappropriate for an area-
based comparison. I believe I must have removed those links from the
pg_operator table during one of my cleanup-and-make-consistent passes.
The right fix would be to put in an appropriate selectivity estimator,
but we can't do that as a 6.5.* patch because changing pg_operator
requires an initdb. It will have to wait for 6.6. (One of my to-do
items for 6.6 was to rewrite the selectivity estimators anyway, so I'll
see what I can do.) In the meantime, I think the only possible patch is
to disable the error check in btreesel and have it return a default
selectivity estimate instead of complaining. Drat.
Apparently, none of the regression tests exercise rtree indexes at all,
else we'd have known there was a problem. Adding an rtree regression test
seems to be strongly indicated as well...
regards, tom lane