|
12 | 12 | *
|
13 | 13 | *
|
14 | 14 | * 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 $ |
16 | 16 | *
|
17 | 17 | *-------------------------------------------------------------------------
|
18 | 18 | */
|
@@ -404,7 +404,21 @@ btreesel(Oid operatorObjectId,
|
404 | 404 | }
|
405 | 405 | else
|
406 | 406 | {
|
407 |
| - result = (float64) fmgr(get_oprrest(operatorObjectId), |
| 407 | + RegProcedure oprrest = 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, |
408 | 422 | (char *) operatorObjectId,
|
409 | 423 | (char *) indrelid,
|
410 | 424 | (char *) (int) attributeNumber,
|
@@ -449,7 +463,21 @@ btreenpage(Oid operatorObjectId,
|
449 | 463 | }
|
450 | 464 | else
|
451 | 465 | {
|
452 |
| - temp = (float64) fmgr(get_oprrest(operatorObjectId), |
| 466 | + RegProcedure oprrest = 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, |
453 | 481 | (char *) operatorObjectId,
|
454 | 482 | (char *) indrelid,
|
455 | 483 | (char *) (int) attributeNumber,
|
@@ -514,7 +542,21 @@ hashsel(Oid operatorObjectId,
|
514 | 542 | }
|
515 | 543 | else
|
516 | 544 | {
|
517 |
| - result = (float64) fmgr(get_oprrest(operatorObjectId), |
| 545 | + RegProcedure oprrest = 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, |
518 | 560 | (char *) operatorObjectId,
|
519 | 561 | (char *) indrelid,
|
520 | 562 | (char *) (int) attributeNumber,
|
@@ -578,7 +620,21 @@ hashnpage(Oid operatorObjectId,
|
578 | 620 | }
|
579 | 621 | else
|
580 | 622 | {
|
581 |
| - temp = (float64) fmgr(get_oprrest(operatorObjectId), |
| 623 | + RegProcedure oprrest = 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, |
582 | 638 | (char *) operatorObjectId,
|
583 | 639 | (char *) indrelid,
|
584 | 640 | (char *) (int) attributeNumber,
|
|
0 commit comments