diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-11-17 21:31:29 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-11-17 21:32:34 -0500 |
commit | fc6d1006bda783cc002c61a5f072905849dbde4b (patch) | |
tree | 555ab6461e7780c0f5a5f21cc80b8f7f17eb844d /src/backend/commands/operatorcmds.c | |
parent | 709aca59608395eef9ceb7dcb79fd9d03a0709ef (diff) | |
download | postgresql-fc6d1006bda783cc002c61a5f072905849dbde4b.tar.gz postgresql-fc6d1006bda783cc002c61a5f072905849dbde4b.zip |
Further consolidation of DROP statement handling.
This gets rid of an impressive amount of duplicative code, with only
minimal behavior changes. DROP FOREIGN DATA WRAPPER now requires object
ownership rather than superuser privileges, matching the documentation
we already have. We also eliminate the historical warning about dropping
a built-in function as unuseful. All operations are now performed in the
same order for all object types handled by dropcmds.c.
KaiGai Kohei, with minor revisions by me
Diffstat (limited to 'src/backend/commands/operatorcmds.c')
-rw-r--r-- | src/backend/commands/operatorcmds.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index c5c18ee4fcc..1e6c5ce2ad7 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -291,56 +291,6 @@ DefineOperator(List *names, List *parameters) /* - * RemoveOperator - * Deletes an operator. - */ -void -RemoveOperator(RemoveFuncStmt *stmt) -{ - List *operatorName = stmt->name; - TypeName *typeName1 = (TypeName *) linitial(stmt->args); - TypeName *typeName2 = (TypeName *) lsecond(stmt->args); - Oid operOid; - HeapTuple tup; - ObjectAddress object; - - Assert(list_length(stmt->args) == 2); - operOid = LookupOperNameTypeNames(NULL, operatorName, - typeName1, typeName2, - stmt->missing_ok, -1); - - if (stmt->missing_ok && !OidIsValid(operOid)) - { - ereport(NOTICE, - (errmsg("operator %s does not exist, skipping", - NameListToString(operatorName)))); - return; - } - - tup = SearchSysCache1(OPEROID, ObjectIdGetDatum(operOid)); - if (!HeapTupleIsValid(tup)) /* should not happen */ - elog(ERROR, "cache lookup failed for operator %u", operOid); - - /* Permission check: must own operator or its namespace */ - if (!pg_oper_ownercheck(operOid, GetUserId()) && - !pg_namespace_ownercheck(((Form_pg_operator) GETSTRUCT(tup))->oprnamespace, - GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_OPER, - NameListToString(operatorName)); - - ReleaseSysCache(tup); - - /* - * Do the deletion - */ - object.classId = OperatorRelationId; - object.objectId = operOid; - object.objectSubId = 0; - - performDeletion(&object, stmt->behavior); -} - -/* * Guts of operator deletion. */ void |