diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2020-06-09 09:10:14 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2020-06-09 09:39:46 +0200 |
commit | b1d32d3e3230f00b5baba08f75b4f665c7d6dac6 (patch) | |
tree | 9b0b6bba1aab417382105d09fc2800f346c7ce2b /src/backend/commands/amcmds.c | |
parent | b27c90bbe4a3d607f8fc6703c7183e56e4039acd (diff) | |
download | postgresql-b1d32d3e3230f00b5baba08f75b4f665c7d6dac6.tar.gz postgresql-b1d32d3e3230f00b5baba08f75b4f665c7d6dac6.zip |
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 <pavel.stehule@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/331d9661-1743-857f-1cbb-d5728bcd62cb%402ndquadrant.com
Diffstat (limited to 'src/backend/commands/amcmds.c')
-rw-r--r-- | src/backend/commands/amcmds.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/backend/commands/amcmds.c b/src/backend/commands/amcmds.c index b884bfa0b00..6f05ee715b4 100644 --- a/src/backend/commands/amcmds.c +++ b/src/backend/commands/amcmds.c @@ -116,33 +116,6 @@ CreateAccessMethod(CreateAmStmt *stmt) } /* - * Guts of access method deletion. - */ -void -RemoveAccessMethodById(Oid amOid) -{ - Relation relation; - HeapTuple tup; - - if (!superuser()) - ereport(ERROR, - (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to drop access methods"))); - - relation = table_open(AccessMethodRelationId, RowExclusiveLock); - - tup = SearchSysCache1(AMOID, ObjectIdGetDatum(amOid)); - if (!HeapTupleIsValid(tup)) - elog(ERROR, "cache lookup failed for access method %u", amOid); - - CatalogTupleDelete(relation, &tup->t_self); - - ReleaseSysCache(tup); - - table_close(relation, RowExclusiveLock); -} - -/* * get_am_type_oid * Worker for various get_am_*_oid variants * |