1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-25 21:42:33 +03:00

Generate a more specific error message when an operator used

in an index doesn't have a restriction selectivity estimator.
This commit is contained in:
Tom Lane 1999-05-31 19:32:47 +00:00
parent cc384fa240
commit 81ced1e037

View File

@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.28 1999/05/25 16:12:20 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.29 1999/05/31 19:32:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -404,7 +404,21 @@ btreesel(Oid operatorObjectId,
} }
else else
{ {
result = (float64) fmgr(get_oprrest(operatorObjectId), RegProcedure oprrest = get_oprrest(operatorObjectId);
/*
* Operators used for indexes should have selectivity estimators.
* (An alternative is to default to 0.5, as the optimizer does in
* dealing with operators occurring in WHERE clauses, but if you
* are going to the trouble of making index support you probably
* don't want to miss the benefits of a good selectivity estimate.)
*/
if (!oprrest)
elog(ERROR,
"Operator %u must have a restriction selectivity estimator to be used in a btree index",
operatorObjectId);
result = (float64) fmgr(oprrest,
(char *) operatorObjectId, (char *) operatorObjectId,
(char *) indrelid, (char *) indrelid,
(char *) (int) attributeNumber, (char *) (int) attributeNumber,
@ -449,7 +463,21 @@ btreenpage(Oid operatorObjectId,
} }
else else
{ {
temp = (float64) fmgr(get_oprrest(operatorObjectId), RegProcedure oprrest = get_oprrest(operatorObjectId);
/*
* Operators used for indexes should have selectivity estimators.
* (An alternative is to default to 0.5, as the optimizer does in
* dealing with operators occurring in WHERE clauses, but if you
* are going to the trouble of making index support you probably
* don't want to miss the benefits of a good selectivity estimate.)
*/
if (!oprrest)
elog(ERROR,
"Operator %u must have a restriction selectivity estimator to be used in a btree index",
operatorObjectId);
temp = (float64) fmgr(oprrest,
(char *) operatorObjectId, (char *) operatorObjectId,
(char *) indrelid, (char *) indrelid,
(char *) (int) attributeNumber, (char *) (int) attributeNumber,
@ -514,7 +542,21 @@ hashsel(Oid operatorObjectId,
} }
else else
{ {
result = (float64) fmgr(get_oprrest(operatorObjectId), RegProcedure oprrest = get_oprrest(operatorObjectId);
/*
* Operators used for indexes should have selectivity estimators.
* (An alternative is to default to 0.5, as the optimizer does in
* dealing with operators occurring in WHERE clauses, but if you
* are going to the trouble of making index support you probably
* don't want to miss the benefits of a good selectivity estimate.)
*/
if (!oprrest)
elog(ERROR,
"Operator %u must have a restriction selectivity estimator to be used in a hash index",
operatorObjectId);
result = (float64) fmgr(oprrest,
(char *) operatorObjectId, (char *) operatorObjectId,
(char *) indrelid, (char *) indrelid,
(char *) (int) attributeNumber, (char *) (int) attributeNumber,
@ -578,7 +620,21 @@ hashnpage(Oid operatorObjectId,
} }
else else
{ {
temp = (float64) fmgr(get_oprrest(operatorObjectId), RegProcedure oprrest = get_oprrest(operatorObjectId);
/*
* Operators used for indexes should have selectivity estimators.
* (An alternative is to default to 0.5, as the optimizer does in
* dealing with operators occurring in WHERE clauses, but if you
* are going to the trouble of making index support you probably
* don't want to miss the benefits of a good selectivity estimate.)
*/
if (!oprrest)
elog(ERROR,
"Operator %u must have a restriction selectivity estimator to be used in a hash index",
operatorObjectId);
temp = (float64) fmgr(oprrest,
(char *) operatorObjectId, (char *) operatorObjectId,
(char *) indrelid, (char *) indrelid,
(char *) (int) attributeNumber, (char *) (int) attributeNumber,