mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
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
This commit is contained in:
@ -507,43 +507,6 @@ PLTemplateExists(const char *languageName)
|
||||
return (find_language_template(languageName) != NULL);
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* DROP PROCEDURAL LANGUAGE
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
void
|
||||
DropProceduralLanguage(DropPLangStmt *stmt)
|
||||
{
|
||||
Oid oid;
|
||||
ObjectAddress object;
|
||||
|
||||
oid = get_language_oid(stmt->plname, stmt->missing_ok);
|
||||
if (!OidIsValid(oid))
|
||||
{
|
||||
ereport(NOTICE,
|
||||
(errmsg("language \"%s\" does not exist, skipping",
|
||||
stmt->plname)));
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check permission
|
||||
*/
|
||||
if (!pg_language_ownercheck(oid, GetUserId()))
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_LANGUAGE,
|
||||
stmt->plname);
|
||||
|
||||
object.classId = LanguageRelationId;
|
||||
object.objectId = oid;
|
||||
object.objectSubId = 0;
|
||||
|
||||
/*
|
||||
* Do the deletion
|
||||
*/
|
||||
performDeletion(&object, stmt->behavior);
|
||||
}
|
||||
|
||||
/*
|
||||
* Guts of language dropping.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user