Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81ced1e

Browse files
committed
Generate a more specific error message when an operator used
in an index doesn't have a restriction selectivity estimator.
1 parentcc384fa commit81ced1e

File tree

1 file changed

+61
-5
lines changed

1 file changed

+61
-5
lines changed

‎src/backend/utils/adt/selfuncs.c

Lines changed: 61 additions & 5 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.28 1999/05/25 16:12:20 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.29 1999/05/31 19:32:47 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -404,7 +404,21 @@ btreesel(Oid operatorObjectId,
404404
}
405405
else
406406
{
407-
result= (float64)fmgr(get_oprrest(operatorObjectId),
407+
RegProcedureoprrest=get_oprrest(operatorObjectId);
408+
409+
/*
410+
* Operators used for indexes should have selectivity estimators.
411+
* (An alternative is to default to 0.5, as the optimizer does in
412+
* dealing with operators occurring in WHERE clauses, but if you
413+
* are going to the trouble of making index support you probably
414+
* don't want to miss the benefits of a good selectivity estimate.)
415+
*/
416+
if (!oprrest)
417+
elog(ERROR,
418+
"Operator %u must have a restriction selectivity estimator to be used in a btree index",
419+
operatorObjectId);
420+
421+
result= (float64)fmgr(oprrest,
408422
(char*)operatorObjectId,
409423
(char*)indrelid,
410424
(char*) (int)attributeNumber,
@@ -449,7 +463,21 @@ btreenpage(Oid operatorObjectId,
449463
}
450464
else
451465
{
452-
temp= (float64)fmgr(get_oprrest(operatorObjectId),
466+
RegProcedureoprrest=get_oprrest(operatorObjectId);
467+
468+
/*
469+
* Operators used for indexes should have selectivity estimators.
470+
* (An alternative is to default to 0.5, as the optimizer does in
471+
* dealing with operators occurring in WHERE clauses, but if you
472+
* are going to the trouble of making index support you probably
473+
* don't want to miss the benefits of a good selectivity estimate.)
474+
*/
475+
if (!oprrest)
476+
elog(ERROR,
477+
"Operator %u must have a restriction selectivity estimator to be used in a btree index",
478+
operatorObjectId);
479+
480+
temp= (float64)fmgr(oprrest,
453481
(char*)operatorObjectId,
454482
(char*)indrelid,
455483
(char*) (int)attributeNumber,
@@ -514,7 +542,21 @@ hashsel(Oid operatorObjectId,
514542
}
515543
else
516544
{
517-
result= (float64)fmgr(get_oprrest(operatorObjectId),
545+
RegProcedureoprrest=get_oprrest(operatorObjectId);
546+
547+
/*
548+
* Operators used for indexes should have selectivity estimators.
549+
* (An alternative is to default to 0.5, as the optimizer does in
550+
* dealing with operators occurring in WHERE clauses, but if you
551+
* are going to the trouble of making index support you probably
552+
* don't want to miss the benefits of a good selectivity estimate.)
553+
*/
554+
if (!oprrest)
555+
elog(ERROR,
556+
"Operator %u must have a restriction selectivity estimator to be used in a hash index",
557+
operatorObjectId);
558+
559+
result= (float64)fmgr(oprrest,
518560
(char*)operatorObjectId,
519561
(char*)indrelid,
520562
(char*) (int)attributeNumber,
@@ -578,7 +620,21 @@ hashnpage(Oid operatorObjectId,
578620
}
579621
else
580622
{
581-
temp= (float64)fmgr(get_oprrest(operatorObjectId),
623+
RegProcedureoprrest=get_oprrest(operatorObjectId);
624+
625+
/*
626+
* Operators used for indexes should have selectivity estimators.
627+
* (An alternative is to default to 0.5, as the optimizer does in
628+
* dealing with operators occurring in WHERE clauses, but if you
629+
* are going to the trouble of making index support you probably
630+
* don't want to miss the benefits of a good selectivity estimate.)
631+
*/
632+
if (!oprrest)
633+
elog(ERROR,
634+
"Operator %u must have a restriction selectivity estimator to be used in a hash index",
635+
operatorObjectId);
636+
637+
temp= (float64)fmgr(oprrest,
582638
(char*)operatorObjectId,
583639
(char*)indrelid,
584640
(char*) (int)attributeNumber,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp