} \
} while(0)
+#define GET_UNCACHED_REL_PROCEDURE(pname) \
+do { \
+ if (!RegProcedureIsValid(indexRelation->rd_am->pname)) \
+ elog(ERROR, "invalid %s regproc", CppAsString(pname)); \
+ fmgr_info(indexRelation->rd_am->pname, &procedure); \
+} while(0)
+
#define GET_SCAN_PROCEDURE(pname) \
do { \
procedure = &scan->indexRelation->rd_aminfo->pname; \
void *callback_state)
{
Relation indexRelation = info->index;
- FmgrInfo *procedure;
+ FmgrInfo procedure;
IndexBulkDeleteResult *result;
RELATION_CHECKS;
- GET_REL_PROCEDURE(ambulkdelete);
+ GET_UNCACHED_REL_PROCEDURE(ambulkdelete);
result = (IndexBulkDeleteResult *)
- DatumGetPointer(FunctionCall4(procedure,
+ DatumGetPointer(FunctionCall4(&procedure,
PointerGetDatum(info),
PointerGetDatum(stats),
PointerGetDatum((Pointer) callback),
IndexBulkDeleteResult *stats)
{
Relation indexRelation = info->index;
- FmgrInfo *procedure;
+ FmgrInfo procedure;
IndexBulkDeleteResult *result;
RELATION_CHECKS;
- GET_REL_PROCEDURE(amvacuumcleanup);
+ GET_UNCACHED_REL_PROCEDURE(amvacuumcleanup);
result = (IndexBulkDeleteResult *)
- DatumGetPointer(FunctionCall2(procedure,
+ DatumGetPointer(FunctionCall2(&procedure,
PointerGetDatum(info),
PointerGetDatum(stats)));
/*
- * Cached lookup information for the index access method functions defined
- * by the pg_am row associated with an index relation.
+ * Cached lookup information for the frequently used index access method
+ * functions, defined by the pg_am row associated with an index relation.
*/
typedef struct RelationAmInfo
{
FmgrInfo amendscan;
FmgrInfo ammarkpos;
FmgrInfo amrestrpos;
- FmgrInfo ambuild;
- FmgrInfo ambuildempty;
- FmgrInfo ambulkdelete;
- FmgrInfo amvacuumcleanup;
FmgrInfo amcanreturn;
- FmgrInfo amcostestimate;
- FmgrInfo amoptions;
} RelationAmInfo;