diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-10-19 23:25:20 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-10-19 23:27:19 -0400 |
commit | 82a4a777d94bec965ab2f1d04b6e6a3f0447b377 (patch) | |
tree | b3560173b695b8391ca81edf47c4b364005a608b /src/backend/commands/extension.c | |
parent | 3301c83536e9da1e573e24ded2e610062dbf9cdc (diff) |
Consolidate DROP handling for some object types.
This gets rid of a significant amount of duplicative code.
KaiGai Kohei, reviewed in earlier versions by Dimitri Fontaine, with
further review and cleanup by me.
Diffstat (limited to 'src/backend/commands/extension.c')
-rw-r--r-- | src/backend/commands/extension.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index ba1e2c45cd9..c334ca9cf8c 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -1563,69 +1563,6 @@ InsertExtensionTuple(const char *extName, Oid extOwner, return extensionOid; } - -/* - * RemoveExtensions - * Implements DROP EXTENSION. - */ -void -RemoveExtensions(DropStmt *drop) -{ - ObjectAddresses *objects; - ListCell *cell; - - /* - * First we identify all the extensions, then we delete them in a single - * performMultipleDeletions() call. This is to avoid unwanted DROP - * RESTRICT errors if one of the extensions depends on another. - */ - objects = new_object_addresses(); - - foreach(cell, drop->objects) - { - List *names = (List *) lfirst(cell); - char *extensionName; - Oid extensionId; - ObjectAddress object; - - if (list_length(names) != 1) - ereport(ERROR, - (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("extension name cannot be qualified"))); - extensionName = strVal(linitial(names)); - - extensionId = get_extension_oid(extensionName, drop->missing_ok); - - if (!OidIsValid(extensionId)) - { - ereport(NOTICE, - (errmsg("extension \"%s\" does not exist, skipping", - extensionName))); - continue; - } - - /* Permission check: must own extension */ - if (!pg_extension_ownercheck(extensionId, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_EXTENSION, - extensionName); - - object.classId = ExtensionRelationId; - object.objectId = extensionId; - object.objectSubId = 0; - - add_exact_object_address(&object, objects); - } - - /* - * Do the deletions. Objects contained in the extension(s) are removed by - * means of their dependency links to the extensions. - */ - performMultipleDeletions(objects, drop->behavior); - - free_object_addresses(objects); -} - - /* * Guts of extension deletion. * |