summaryrefslogtreecommitdiff
path: root/src/backend/executor/execAmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/execAmi.c')
-rw-r--r--src/backend/executor/execAmi.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index ada54a102d8..35864c16813 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -12,6 +12,7 @@
*/
#include "postgres.h"
+#include "access/amapi.h"
#include "access/htup_details.h"
#include "executor/execdebug.h"
#include "executor/nodeAgg.h"
@@ -542,9 +543,8 @@ IndexSupportsBackwardScan(Oid indexid)
{
bool result;
HeapTuple ht_idxrel;
- HeapTuple ht_am;
Form_pg_class idxrelrec;
- Form_pg_am amrec;
+ IndexAmRoutine *amroutine;
/* Fetch the pg_class tuple of the index relation */
ht_idxrel = SearchSysCache1(RELOID, ObjectIdGetDatum(indexid));
@@ -552,17 +552,13 @@ IndexSupportsBackwardScan(Oid indexid)
elog(ERROR, "cache lookup failed for relation %u", indexid);
idxrelrec = (Form_pg_class) GETSTRUCT(ht_idxrel);
- /* Fetch the pg_am tuple of the index' access method */
- ht_am = SearchSysCache1(AMOID, ObjectIdGetDatum(idxrelrec->relam));
- if (!HeapTupleIsValid(ht_am))
- elog(ERROR, "cache lookup failed for access method %u",
- idxrelrec->relam);
- amrec = (Form_pg_am) GETSTRUCT(ht_am);
+ /* Fetch the index AM's API struct */
+ amroutine = GetIndexAmRoutineByAmId(idxrelrec->relam);
- result = amrec->amcanbackward;
+ result = amroutine->amcanbackward;
+ pfree(amroutine);
ReleaseSysCache(ht_idxrel);
- ReleaseSysCache(ht_am);
return result;
}