Skip to content

Commit d30c4b0

Browse files
committed
Temporarily disable error checks for missing selectivity
functions, in order to work around oversight in 6.5 release: rtree index functions haven't got any. Mea culpa ...
1 parent 0591bbd commit d30c4b0

File tree

1 file changed

+44
-19
lines changed

1 file changed

+44
-19
lines changed

src/backend/utils/adt/selfuncs.c

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.29 1999/05/31 19:32:47 tgl Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.30 1999/06/19 00:44:44 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -414,17 +414,29 @@ btreesel(Oid operatorObjectId,
414414
* don't want to miss the benefits of a good selectivity estimate.)
415415
*/
416416
if (!oprrest)
417+
{
418+
#if 1
419+
/*
420+
* XXX temporary fix for 6.5: rtree operators are missing their
421+
* selectivity estimators, so return a default estimate instead.
422+
* Ugh.
423+
*/
424+
result = (float64) palloc(sizeof(float64data));
425+
*result = 0.5;
426+
#else
417427
elog(ERROR,
418-
"Operator %u must have a restriction selectivity estimator to be used in a btree index",
428+
"Operator %u must have a restriction selectivity estimator to be used in an index",
419429
operatorObjectId);
420-
421-
result = (float64) fmgr(oprrest,
422-
(char *) operatorObjectId,
423-
(char *) indrelid,
424-
(char *) (int) attributeNumber,
425-
(char *) constValue,
426-
(char *) constFlag,
427-
NULL);
430+
#endif
431+
}
432+
else
433+
result = (float64) fmgr(oprrest,
434+
(char *) operatorObjectId,
435+
(char *) indrelid,
436+
(char *) (int) attributeNumber,
437+
(char *) constValue,
438+
(char *) constFlag,
439+
NULL);
428440
}
429441

430442
if (!PointerIsValid(result))
@@ -473,18 +485,31 @@ btreenpage(Oid operatorObjectId,
473485
* don't want to miss the benefits of a good selectivity estimate.)
474486
*/
475487
if (!oprrest)
488+
{
489+
#if 1
490+
/*
491+
* XXX temporary fix for 6.5: rtree operators are missing their
492+
* selectivity estimators, so return a default estimate instead.
493+
* Ugh.
494+
*/
495+
tempData = 0.5;
496+
temp = &tempData;
497+
#else
476498
elog(ERROR,
477-
"Operator %u must have a restriction selectivity estimator to be used in a btree index",
499+
"Operator %u must have a restriction selectivity estimator to be used in an index",
478500
operatorObjectId);
479-
480-
temp = (float64) fmgr(oprrest,
481-
(char *) operatorObjectId,
482-
(char *) indrelid,
483-
(char *) (int) attributeNumber,
484-
(char *) constValue,
485-
(char *) constFlag,
486-
NULL);
501+
#endif
502+
}
503+
else
504+
temp = (float64) fmgr(oprrest,
505+
(char *) operatorObjectId,
506+
(char *) indrelid,
507+
(char *) (int) attributeNumber,
508+
(char *) constValue,
509+
(char *) constFlag,
510+
NULL);
487511
}
512+
488513
atp = SearchSysCacheTuple(RELOID,
489514
ObjectIdGetDatum(indexrelid),
490515
0, 0, 0);

0 commit comments

Comments
 (0)