summaryrefslogtreecommitdiff
path: root/src/backend/commands/foreigncmds.c
diff options
context:
space:
mode:
authorPeter Eisentraut2020-06-09 07:10:14 +0000
committerPeter Eisentraut2020-06-09 07:39:46 +0000
commitb1d32d3e3230f00b5baba08f75b4f665c7d6dac6 (patch)
tree9b0b6bba1aab417382105d09fc2800f346c7ce2b /src/backend/commands/foreigncmds.c
parentb27c90bbe4a3d607f8fc6703c7183e56e4039acd (diff)
Unify drop-by-OID functions
There are a number of Remove${Something}ById() functions that are essentially identical in structure and only different in which catalog they are working on. Refactor this to be one generic function. The information about which oid column, index, etc. to use was already available in ObjectProperty for most catalogs, in a few cases it was easily added. Reviewed-by: Pavel Stehule <[email protected]> Reviewed-by: Robert Haas <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/331d9661-1743-857f-1cbb-d5728bcd62cb%402ndquadrant.com
Diffstat (limited to 'src/backend/commands/foreigncmds.c')
-rw-r--r--src/backend/commands/foreigncmds.c71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index a399ab4de9c..de31ddd1f38 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -836,30 +836,6 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
/*
- * Drop foreign-data wrapper by OID
- */
-void
-RemoveForeignDataWrapperById(Oid fdwId)
-{
- HeapTuple tp;
- Relation rel;
-
- rel = table_open(ForeignDataWrapperRelationId, RowExclusiveLock);
-
- tp = SearchSysCache1(FOREIGNDATAWRAPPEROID, ObjectIdGetDatum(fdwId));
-
- if (!HeapTupleIsValid(tp))
- elog(ERROR, "cache lookup failed for foreign-data wrapper %u", fdwId);
-
- CatalogTupleDelete(rel, &tp->t_self);
-
- ReleaseSysCache(tp);
-
- table_close(rel, RowExclusiveLock);
-}
-
-
-/*
* Create a foreign server
*/
ObjectAddress
@@ -1086,30 +1062,6 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
/*
- * Drop foreign server by OID
- */
-void
-RemoveForeignServerById(Oid srvId)
-{
- HeapTuple tp;
- Relation rel;
-
- rel = table_open(ForeignServerRelationId, RowExclusiveLock);
-
- tp = SearchSysCache1(FOREIGNSERVEROID, ObjectIdGetDatum(srvId));
-
- if (!HeapTupleIsValid(tp))
- elog(ERROR, "cache lookup failed for foreign server %u", srvId);
-
- CatalogTupleDelete(rel, &tp->t_self);
-
- ReleaseSysCache(tp);
-
- table_close(rel, RowExclusiveLock);
-}
-
-
-/*
* Common routine to check permission for user-mapping-related DDL
* commands. We allow server owners to operate on any mapping, and
* users to operate on their own mapping.
@@ -1436,29 +1388,6 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
/*
- * Drop user mapping by OID. This is called to clean up dependencies.
- */
-void
-RemoveUserMappingById(Oid umId)
-{
- HeapTuple tp;
- Relation rel;
-
- rel = table_open(UserMappingRelationId, RowExclusiveLock);
-
- tp = SearchSysCache1(USERMAPPINGOID, ObjectIdGetDatum(umId));
-
- if (!HeapTupleIsValid(tp))
- elog(ERROR, "cache lookup failed for user mapping %u", umId);
-
- CatalogTupleDelete(rel, &tp->t_self);
-
- ReleaseSysCache(tp);
-
- table_close(rel, RowExclusiveLock);
-}
-
-/*
* Create a foreign table
* call after DefineRelation().
*/