aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/index/amapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/index/amapi.c')
-rw-r--r--src/backend/access/index/amapi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/access/index/amapi.c b/src/backend/access/index/amapi.c
index bda166a9ef8..d347ebcba45 100644
--- a/src/backend/access/index/amapi.c
+++ b/src/backend/access/index/amapi.c
@@ -62,6 +62,13 @@ GetIndexAmRoutineByAmId(Oid amoid)
amoid);
amform = (Form_pg_am) GETSTRUCT(tuple);
+ /* Check if it's index access method */
+ if (amform->amtype != AMTYPE_INDEX)
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("access method \"%s\" is not of type %s",
+ NameStr(amform->amname), "INDEX")));
+
amhandler = amform->amhandler;
/* Complain if handler OID is invalid */