aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/index
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2016-03-23 23:01:35 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2016-03-23 23:01:35 -0300
commit473b93287040b20017cc25a157cffdc5b978c254 (patch)
tree58f662a65247525b2e5e178b9050feb3f3056590 /src/backend/access/index
parent2c6af4f44228d76d3351fe26f68b00b55cdd239a (diff)
downloadpostgresql-473b93287040b20017cc25a157cffdc5b978c254.tar.gz
postgresql-473b93287040b20017cc25a157cffdc5b978c254.zip
Support CREATE ACCESS METHOD
This enables external code to create access methods. This is useful so that extensions can add their own access methods which can be formally tracked for dependencies, so that DROP operates correctly. Also, having explicit support makes pg_dump work correctly. Currently only index AMs are supported, but we expect different types to be added in the future. Authors: Alexander Korotkov, Petr Jelínek Reviewed-By: Teodor Sigaev, Petr Jelínek, Jim Nasby Commitfest-URL: https://commitfest.postgresql.org/9/353/ Discussion: https://www.postgresql.org/message-id/CAPpHfdsXwZmojm6Dx+TJnpYk27kT4o7Ri6X_4OSWcByu1Rm+VA@mail.gmail.com
Diffstat (limited to 'src/backend/access/index')
-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 */