summaryrefslogtreecommitdiff
path: root/src/backend/commands/opclasscmds.c
diff options
context:
space:
mode:
authorTom Lane2016-04-14 03:33:31 +0000
committerTom Lane2016-04-14 03:33:31 +0000
commit92a30a7eb0cadb008e18053f199af7de3fc1abaa (patch)
tree6c755da85fbfe8bbc896fd98b1655d8b8a32df42 /src/backend/commands/opclasscmds.c
parentc8cb7453233b31a177b08a3b2bdac4c31508dc00 (diff)
Fix broken dependency-mongering for index operator classes/families.
For a long time, opclasscmds.c explained that "we do not create a dependency link to the AM [for an opclass or opfamily], because we don't currently support DROP ACCESS METHOD". Commit 473b93287040b200 invented DROP ACCESS METHOD, but it batted only 1 for 2 on adding the dependency links, and 0 for 2 on updating the comments about the topic. In passing, undo the same commit's entirely inappropriate decision to blow away an existing index as a side-effect of create_am.sql.
Diffstat (limited to 'src/backend/commands/opclasscmds.c')
-rw-r--r--src/backend/commands/opclasscmds.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index ac559fc9b41..5f665cf3a20 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -285,14 +285,18 @@ CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
heap_freetuple(tup);
/*
- * Create dependencies for the opfamily proper. Note: we do not create a
- * dependency link to the AM, because we don't currently support DROP
- * ACCESS METHOD.
+ * Create dependencies for the opfamily proper.
*/
myself.classId = OperatorFamilyRelationId;
myself.objectId = opfamilyoid;
myself.objectSubId = 0;
+ /* dependency on access method */
+ referenced.classId = AccessMethodRelationId;
+ referenced.objectId = amoid;
+ referenced.objectSubId = 0;
+ recordDependencyOn(&myself, &referenced, DEPENDENCY_AUTO);
+
/* dependency on namespace */
referenced.classId = NamespaceRelationId;
referenced.objectId = namespaceoid;
@@ -670,20 +674,13 @@ DefineOpClass(CreateOpClassStmt *stmt)
EventTriggerCollectCreateOpClass(stmt, opclassoid, operators, procedures);
/*
- * Create dependencies for the opclass proper. Note: we do not create a
- * dependency link to the AM, because we don't currently support DROP
- * ACCESS METHOD.
+ * Create dependencies for the opclass proper. Note: we do not need a
+ * dependency link to the AM, because that exists through the opfamily.
*/
myself.classId = OperatorClassRelationId;
myself.objectId = opclassoid;
myself.objectSubId = 0;
- /* dependency on access method */
- referenced.classId = AccessMethodRelationId;
- referenced.objectId = amoid;
- referenced.objectSubId = 0;
- recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
-
/* dependency on namespace */
referenced.classId = NamespaceRelationId;
referenced.objectId = namespaceoid;