1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Third round of fmgr updates: eliminate calls using fmgr() and

fmgr_faddr() in favor of new-style calls.  Lots of cleanup of
sloppy casts to use XXXGetDatum and DatumGetXXX ...
This commit is contained in:
Tom Lane
2000-05-30 04:25:00 +00:00
parent a12a23f0d0
commit 0f1e39643d
35 changed files with 570 additions and 443 deletions

View File

@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.59 2000/05/30 00:49:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.60 2000/05/30 04:24:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -240,8 +240,14 @@ cost_index(Path *path, Query *root,
* index (ie, the fraction of main-table tuples we will have to
* retrieve).
*/
fmgr(index->amcostestimate, root, baserel, index, indexQuals,
&indexStartupCost, &indexTotalCost, &indexSelectivity);
OidFunctionCall7(index->amcostestimate,
PointerGetDatum(root),
PointerGetDatum(baserel),
PointerGetDatum(index),
PointerGetDatum(indexQuals),
PointerGetDatum(&indexStartupCost),
PointerGetDatum(&indexTotalCost),
PointerGetDatum(&indexSelectivity));
/* all costs for touching index itself included here */
startup_cost += indexStartupCost;

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.52 2000/05/30 00:49:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.53 2000/05/30 04:24:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -195,22 +195,19 @@ restriction_selectivity(Oid functionObjectId,
Datum constValue,
int constFlag)
{
float64 result;
float8 result;
result = (float64) fmgr(functionObjectId,
(char *) operatorObjectId,
(char *) relationObjectId,
(char *) (int) attributeNumber,
(char *) constValue,
(char *) constFlag,
NULL);
if (!PointerIsValid(result))
elog(ERROR, "restriction_selectivity: bad pointer");
result = DatumGetFloat8(OidFunctionCall5(functionObjectId,
ObjectIdGetDatum(operatorObjectId),
ObjectIdGetDatum(relationObjectId),
Int16GetDatum(attributeNumber),
constValue,
Int32GetDatum(constFlag)));
if (*result < 0.0 || *result > 1.0)
elog(ERROR, "restriction_selectivity: bad value %f", *result);
if (result < 0.0 || result > 1.0)
elog(ERROR, "restriction_selectivity: bad value %f", result);
return (Selectivity) *result;
return (Selectivity) result;
}
/*
@ -231,22 +228,19 @@ join_selectivity(Oid functionObjectId,
Oid relationObjectId2,
AttrNumber attributeNumber2)
{
float64 result;
float8 result;
result = (float64) fmgr(functionObjectId,
(char *) operatorObjectId,
(char *) relationObjectId1,
(char *) (int) attributeNumber1,
(char *) relationObjectId2,
(char *) (int) attributeNumber2,
NULL);
if (!PointerIsValid(result))
elog(ERROR, "join_selectivity: bad pointer");
result = DatumGetFloat8(OidFunctionCall5(functionObjectId,
ObjectIdGetDatum(operatorObjectId),
ObjectIdGetDatum(relationObjectId1),
Int16GetDatum(attributeNumber1),
ObjectIdGetDatum(relationObjectId2),
Int16GetDatum(attributeNumber2)));
if (*result < 0.0 || *result > 1.0)
elog(ERROR, "join_selectivity: bad value %f", *result);
if (result < 0.0 || result > 1.0)
elog(ERROR, "join_selectivity: bad value %f", result);
return (Selectivity) *result;
return (Selectivity) result;
}
/*