From e1b4a1bbb7a9018d6a00a31d8558bb66617acb3f Mon Sep 17 00:00:00 2001
From: Mark Dilger <mark.dilger@enterprisedb.com>
Date: Thu, 19 Aug 2021 12:05:19 -0700
Subject: [PATCH v5 12/12] Create new role pg_manage_database_objects

Add a new role to the system with privileges to do anything to an
object that the object owner could do, so long as the object is not
owned by a superuser.  This latter restriction is to avoid privilege
escalation attacks.
---
 doc/src/sgml/user-manag.sgml            |   11 +
 src/backend/catalog/aclchk.c            |   47 +-
 src/backend/catalog/pg_type.c           |    4 +-
 src/backend/commands/alter.c            |   12 +-
 src/backend/commands/dbcommands.c       |    6 +-
 src/backend/commands/event_trigger.c    |    2 +-
 src/backend/commands/foreigncmds.c      |    4 +-
 src/backend/commands/publicationcmds.c  |    4 +-
 src/backend/commands/schemacmds.c       |    6 +-
 src/backend/commands/subscriptioncmds.c |    2 +-
 src/backend/commands/tablecmds.c        |    4 +-
 src/backend/commands/typecmds.c         |    4 +-
 src/backend/commands/user.c             |    6 +-
 src/backend/utils/adt/acl.c             |   56 +-
 src/include/catalog/pg_authid.dat       |    5 +
 src/include/utils/acl.h                 |    3 +
 src/test/regress/expected/role_priv.out | 1202 +++++++++++++++++++++++
 src/test/regress/parallel_schedule      |    2 +-
 src/test/regress/sql/role_priv.sql      |  879 +++++++++++++++++
 19 files changed, 2206 insertions(+), 53 deletions(-)
 create mode 100644 src/test/regress/expected/role_priv.out
 create mode 100644 src/test/regress/sql/role_priv.sql

diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml
index 5fd8a5d2f7..596cf7ad7e 100644
--- a/doc/src/sgml/user-manag.sgml
+++ b/doc/src/sgml/user-manag.sgml
@@ -597,6 +597,10 @@ DROP ROLE doomed_role;
        <entry>pg_manage_logging_settings</entry>
        <entry>Allow changing settings which control logging behavior.</entry>
       </row>
+      <row>
+       <entry>pg_manage_database_objects</entry>
+       <entry>Allow altering database objects which the role does not own.</entry>
+      </row>
      </tbody>
     </tgroup>
    </table>
@@ -649,6 +653,13 @@ DROP ROLE doomed_role;
   server.
   </para>
 
+  <para>
+  The <literal>pg_manage_database_objects</literal> role is intended to allow
+  administrators to have trusted, but non-superuser, roles to perform actions
+  on objects with the same privileges as the object owners, so long as the
+  objects are not owned by superusers.
+  </para>
+
   <para>
   Care should be taken when granting these roles to ensure they are only used where
   needed and with the understanding that these roles grant access to privileged
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 89792b154e..6c127333e9 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -3958,8 +3958,7 @@ pg_database_aclmask(Oid db_oid, Oid roleid,
 	Acl		   *acl;
 	Oid			ownerId;
 
-	/* Superusers bypass all permission checking. */
-	if (superuser_arg(roleid))
+	if (has_privs_of_role(roleid, ROLE_PG_MANAGE_DATABASE_OBJECTS))
 		return mask;
 
 	/*
@@ -4834,7 +4833,7 @@ pg_class_ownercheck(Oid class_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -4860,7 +4859,7 @@ pg_type_ownercheck(Oid type_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -4886,7 +4885,7 @@ pg_oper_ownercheck(Oid oper_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -4912,7 +4911,7 @@ pg_proc_ownercheck(Oid proc_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -4938,7 +4937,7 @@ pg_language_ownercheck(Oid lan_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -4984,7 +4983,7 @@ pg_largeobject_ownercheck(Oid lobj_oid, Oid roleid)
 	systable_endscan(scan);
 	table_close(pg_lo_meta, AccessShareLock);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5010,7 +5009,7 @@ pg_namespace_ownercheck(Oid nsp_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5037,7 +5036,7 @@ pg_tablespace_ownercheck(Oid spc_oid, Oid roleid)
 
 	ReleaseSysCache(spctuple);
 
-	return has_privs_of_role(roleid, spcowner);
+	return may_manage_roles_objects(roleid, spcowner);
 }
 
 /*
@@ -5064,7 +5063,7 @@ pg_opclass_ownercheck(Oid opc_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5091,7 +5090,7 @@ pg_opfamily_ownercheck(Oid opf_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5118,7 +5117,7 @@ pg_ts_dict_ownercheck(Oid dict_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5145,7 +5144,7 @@ pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5172,7 +5171,7 @@ pg_foreign_data_wrapper_ownercheck(Oid srv_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5199,7 +5198,7 @@ pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5226,7 +5225,7 @@ pg_event_trigger_ownercheck(Oid et_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5252,7 +5251,7 @@ pg_database_ownercheck(Oid db_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, dba);
+	return may_manage_roles_objects(roleid, dba);
 }
 
 /*
@@ -5278,7 +5277,7 @@ pg_collation_ownercheck(Oid coll_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5304,7 +5303,7 @@ pg_conversion_ownercheck(Oid conv_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5346,7 +5345,7 @@ pg_extension_ownercheck(Oid ext_oid, Oid roleid)
 	systable_endscan(scan);
 	table_close(pg_extension, AccessShareLock);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5372,7 +5371,7 @@ pg_publication_ownercheck(Oid pub_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5398,7 +5397,7 @@ pg_subscription_ownercheck(Oid sub_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
@@ -5425,7 +5424,7 @@ pg_statistics_object_ownercheck(Oid stat_oid, Oid roleid)
 
 	ReleaseSysCache(tuple);
 
-	return has_privs_of_role(roleid, ownerId);
+	return may_manage_roles_objects(roleid, ownerId);
 }
 
 /*
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index cdce22f394..f6cf776849 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -22,6 +22,7 @@
 #include "catalog/dependency.h"
 #include "catalog/indexing.h"
 #include "catalog/objectaccess.h"
+#include "catalog/pg_authid.h"
 #include "catalog/pg_collation.h"
 #include "catalog/pg_namespace.h"
 #include "catalog/pg_proc.h"
@@ -438,7 +439,8 @@ TypeCreate(Oid newTypeOid,
 		/*
 		 * shell type must have been created by same owner
 		 */
-		if (typform->typowner != ownerId)
+		if (typform->typowner != ownerId &&
+			!has_privs_of_role(ownerId, ROLE_PG_MANAGE_DATABASE_OBJECTS))
 			aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_TYPE, typeName);
 
 		/* trouble if caller wanted to force the OID */
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index 29249498a9..0b33cc9c97 100644
--- a/src/backend/commands/alter.c
+++ b/src/backend/commands/alter.c
@@ -221,7 +221,7 @@ AlterObjectRename_internal(Relation rel, Oid objectId, const char *new_name)
 		Assert(!isnull);
 		ownerId = DatumGetObjectId(datum);
 
-		if (!has_privs_of_role(GetUserId(), DatumGetObjectId(ownerId)))
+		if (!may_manage_roles_objects(GetUserId(), DatumGetObjectId(ownerId)))
 			aclcheck_error(ACLCHECK_NOT_OWNER, get_object_type(classId, objectId),
 						   old_name);
 
@@ -749,7 +749,7 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid)
 		Assert(!isnull);
 		ownerId = DatumGetObjectId(owner);
 
-		if (!has_privs_of_role(GetUserId(), ownerId))
+		if (!may_manage_roles_objects(GetUserId(), ownerId))
 			aclcheck_error(ACLCHECK_NOT_OWNER, get_object_type(classId, objid),
 						   NameStr(*(DatumGetName(name))));
 
@@ -974,8 +974,8 @@ AlterObjectOwner_internal(Relation rel, Oid objectId, Oid new_ownerId)
 		/* Superusers can bypass permission checks */
 		if (!superuser())
 		{
-			/* must be owner */
-			if (!has_privs_of_role(GetUserId(), old_ownerId))
+			/* must be able to act as owner */
+			if (!may_manage_roles_objects(GetUserId(), old_ownerId))
 			{
 				char	   *objname;
 				char		namebuf[NAMEDATALEN];
@@ -995,8 +995,8 @@ AlterObjectOwner_internal(Relation rel, Oid objectId, Oid new_ownerId)
 				aclcheck_error(ACLCHECK_NOT_OWNER, get_object_type(classId, objectId),
 							   objname);
 			}
-			/* Must be able to become new owner */
-			check_is_member_of_role(GetUserId(), new_ownerId);
+			/* Must be able to act as new owner */
+			check_may_manage_roles_objects(GetUserId(), new_ownerId);
 
 			/* New owner must have CREATE privilege on namespace */
 			if (OidIsValid(namespaceId))
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 029fab48df..35d5419689 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -302,7 +302,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 				 errmsg("permission denied to create database")));
 
-	check_is_member_of_role(GetUserId(), datdba);
+	check_may_manage_roles_objects(GetUserId(), datdba);
 
 	/*
 	 * Lookup database (template) to be cloned, and obtain share lock on it.
@@ -1682,8 +1682,8 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
 			aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_DATABASE,
 						   dbname);
 
-		/* Must be able to become new owner */
-		check_is_member_of_role(GetUserId(), newOwnerId);
+		/* Must be able to act as new owner */
+		check_may_manage_roles_objects(GetUserId(), newOwnerId);
 
 		/*
 		 * must have createdb rights
diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c
index 13db569775..e10261ec49 100644
--- a/src/backend/commands/event_trigger.c
+++ b/src/backend/commands/event_trigger.c
@@ -477,7 +477,7 @@ AlterEventTriggerOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
 					   NameStr(form->evtname));
 
 	/* Must be able to assign ownership to the target role */
-	check_is_member_of_role(GetUserId(), newOwnerId);
+	check_may_manage_roles_objects(GetUserId(), newOwnerId);
 
 	form->evtowner = newOwnerId;
 	CatalogTupleUpdate(rel, &tup->t_self, tup);
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index 9b71beb1d3..ed995b175c 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -362,8 +362,8 @@ AlterForeignServerOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
 				aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_FOREIGN_SERVER,
 							   NameStr(form->srvname));
 
-			/* Must be able to become new owner */
-			check_is_member_of_role(GetUserId(), newOwnerId);
+			/* Must be able to act as new owner */
+			check_may_manage_roles_objects(GetUserId(), newOwnerId);
 
 			/* New owner must have USAGE privilege on foreign-data wrapper */
 			aclresult = pg_foreign_data_wrapper_aclcheck(form->srvfdw, newOwnerId, ACL_USAGE);
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 8487eeb7e6..105414332c 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -687,8 +687,8 @@ AlterPublicationOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
 			aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_PUBLICATION,
 						   NameStr(form->pubname));
 
-		/* Must be able to become new owner */
-		check_is_member_of_role(GetUserId(), newOwnerId);
+		/* Must be able to act as new owner */
+		check_may_manage_roles_objects(GetUserId(), newOwnerId);
 
 		/* New owner must have CREATE privilege on database */
 		aclresult = pg_database_aclcheck(MyDatabaseId, newOwnerId, ACL_CREATE);
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 6c6ab9ee34..901deccba9 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -96,7 +96,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString,
 		aclcheck_error(aclresult, OBJECT_DATABASE,
 					   get_database_name(MyDatabaseId));
 
-	check_is_member_of_role(saved_uid, owner_uid);
+	check_may_manage_roles_objects(saved_uid, owner_uid);
 
 	/* Additional check to protect reserved schema names */
 	if (!allowSystemTableMods && IsReservedName(schemaName))
@@ -357,8 +357,8 @@ AlterSchemaOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
 			aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_SCHEMA,
 						   NameStr(nspForm->nspname));
 
-		/* Must be able to become new owner */
-		check_is_member_of_role(GetUserId(), newOwnerId);
+		/* Must be able to act as new owner */
+		check_may_manage_roles_objects(GetUserId(), newOwnerId);
 
 		/*
 		 * must have create-schema rights
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index eacb1a4a00..57666f30ba 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -1480,7 +1480,7 @@ AlterSubscriptionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
 					   NameStr(form->subname));
 
 	/* Must be able to assign ownership to the target role */
-	check_is_member_of_role(GetUserId(), newOwnerId);
+	check_may_manage_roles_objects(GetUserId(), newOwnerId);
 
 	form->subowner = newOwnerId;
 	CatalogTupleUpdate(rel, &tup->t_self, tup);
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index a03077139d..34acf59039 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -13322,8 +13322,8 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock
 					aclcheck_error(ACLCHECK_NOT_OWNER, get_relkind_objtype(get_rel_relkind(relationOid)),
 								   RelationGetRelationName(target_rel));
 
-				/* Must be able to become new owner */
-				check_is_member_of_role(GetUserId(), newOwnerId);
+				/* Must be able to act as new owner */
+				check_may_manage_roles_objects(GetUserId(), newOwnerId);
 
 				/* New owner must have CREATE privilege on namespace */
 				aclresult = pg_namespace_aclcheck(namespaceOid, newOwnerId,
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 6bdb1a1660..a8cb8ecb58 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -3748,8 +3748,8 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype)
 			if (!pg_type_ownercheck(typTup->oid, GetUserId()))
 				aclcheck_error_type(ACLCHECK_NOT_OWNER, typTup->oid);
 
-			/* Must be able to become new owner */
-			check_is_member_of_role(GetUserId(), newOwnerId);
+			/* Must be able to act as new owner */
+			check_may_manage_roles_objects(GetUserId(), newOwnerId);
 
 			/* New owner must have CREATE privilege on namespace */
 			aclresult = pg_namespace_aclcheck(typTup->typnamespace,
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index aa69821be4..3cd874b170 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -1320,7 +1320,7 @@ DropOwnedObjects(DropOwnedStmt *stmt)
 	{
 		Oid			roleid = lfirst_oid(cell);
 
-		if (!has_privs_of_role(GetUserId(), roleid))
+		if (!may_manage_roles_objects(GetUserId(), roleid))
 			ereport(ERROR,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 					 errmsg("permission denied to drop objects")));
@@ -1347,7 +1347,7 @@ ReassignOwnedObjects(ReassignOwnedStmt *stmt)
 	{
 		Oid			roleid = lfirst_oid(cell);
 
-		if (!has_privs_of_role(GetUserId(), roleid))
+		if (!may_manage_roles_objects(GetUserId(), roleid))
 			ereport(ERROR,
 					(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 					 errmsg("permission denied to reassign objects")));
@@ -1356,7 +1356,7 @@ ReassignOwnedObjects(ReassignOwnedStmt *stmt)
 	/* Must have privileges on the receiving side too */
 	newrole = get_rolespec_oid(stmt->newrole, false);
 
-	if (!has_privs_of_role(GetUserId(), newrole))
+	if (!may_manage_roles_objects(GetUserId(), newrole))
 		ereport(ERROR,
 				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 				 errmsg("permission denied to reassign objects")));
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 67f8b29434..1a467d0370 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -1329,7 +1329,7 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
 
 	/* Owner always implicitly has all grant options */
 	if ((mask & ACLITEM_ALL_GOPTION_BITS) &&
-		has_privs_of_role(roleid, ownerId))
+		may_manage_roles_objects(roleid, ownerId))
 	{
 		result = mask & ACLITEM_ALL_GOPTION_BITS;
 		if ((how == ACLMASK_ALL) ? (result == mask) : (result != 0))
@@ -1372,7 +1372,7 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
 			continue;			/* already checked it */
 
 		if ((aidata->ai_privs & remaining) &&
-			has_privs_of_role(roleid, aidata->ai_grantee))
+			may_manage_roles_objects(roleid, aidata->ai_grantee))
 		{
 			result |= aidata->ai_privs & mask;
 			if ((how == ACLMASK_ALL) ? (result == mask) : (result != 0))
@@ -4859,6 +4859,43 @@ has_privs_of_role(Oid member, Oid role)
 						   role);
 }
 
+/*
+ * Does member have the privileges of role, or failing that, does member
+ * have the right to manage role's objects.
+ *
+ * Members of role pg_manage_database_objects may manage role's objects
+ * if and only if role is not a superuser.
+ */
+bool
+may_manage_roles_objects(Oid member, Oid role)
+{
+	List    *roles;
+
+	/* Fast path for simple case */
+	if (member == role)
+		return true;
+
+	/* Superusers have every privilege, so are part of every role */
+	if (superuser_arg(member))
+		return true;
+
+	/*
+	 * Find all the roles that member has the privileges of, including
+	 * multi-level recursion.
+	 */
+	roles = roles_is_member_of(member, ROLERECURSE_PRIVS, InvalidOid, NULL);
+
+	/* role may manage its own objects. */
+	if (list_member_oid(roles, role))
+		return true;
+
+	/* pg_manage_database_objects may manage non-superuser owned objects. */
+	if (!superuser_arg(role) &&
+		list_member_oid(roles, ROLE_PG_MANAGE_DATABASE_OBJECTS))
+		return true;
+
+	return false;
+}
 
 /*
  * Is member a member of role (directly or indirectly)?
@@ -4899,6 +4936,21 @@ check_is_member_of_role(Oid member, Oid role)
 						GetUserNameFromId(role, false))));
 }
 
+/*
+ * check_may_manage_roles_objects
+ *		may_manage_roles_objects with a standard permission-violation error if
+ *		not
+ */
+void
+check_may_manage_roles_objects(Oid member, Oid role)
+{
+	if (!may_manage_roles_objects(member, role))
+		ereport(ERROR,
+				(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
+				 errmsg("must be member of role \"%s\"",
+						GetUserNameFromId(role, false))));
+}
+
 /*
  * Is member a member of role, not considering superuserness?
  *
diff --git a/src/include/catalog/pg_authid.dat b/src/include/catalog/pg_authid.dat
index 41d119f7b2..5bda6bc10f 100644
--- a/src/include/catalog/pg_authid.dat
+++ b/src/include/catalog/pg_authid.dat
@@ -99,5 +99,10 @@
   rolcreaterole => 'f', rolcreatedb => 'f', rolcanlogin => 'f',
   rolreplication => 'f', rolbypassrls => 't', rolconnlimit => '-1',
   rolpassword => '_null_', rolvaliduntil => '_null_' },
+{ oid => '9283', oid_symbol => 'ROLE_PG_MANAGE_DATABASE_OBJECTS',
+  rolname => 'pg_manage_database_objects', rolsuper => 'f', rolinherit => 't',
+  rolcreaterole => 'f', rolcreatedb => 'f', rolcanlogin => 'f',
+  rolreplication => 'f', rolbypassrls => 't', rolconnlimit => '-1',
+  rolpassword => '_null_', rolvaliduntil => '_null_' },
 
 ]
diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h
index af771c901d..ddcbada55d 100644
--- a/src/include/utils/acl.h
+++ b/src/include/utils/acl.h
@@ -206,10 +206,13 @@ extern AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId,
 extern int	aclmembers(const Acl *acl, Oid **roleids);
 
 extern bool has_privs_of_role(Oid member, Oid role);
+extern bool may_manage_roles_objects(Oid member, Oid role);
 extern bool is_member_of_role(Oid member, Oid role);
+extern bool may_manage_roles_objects(Oid member, Oid role);
 extern bool is_member_of_role_nosuper(Oid member, Oid role);
 extern bool is_admin_of_role(Oid member, Oid role);
 extern void check_is_member_of_role(Oid member, Oid role);
+extern void check_may_manage_roles_objects(Oid member, Oid role);
 extern Oid	get_role_oid(const char *rolename, bool missing_ok);
 extern Oid	get_role_oid_or_public(const char *rolename);
 extern Oid	get_rolespec_oid(const RoleSpec *role, bool missing_ok);
diff --git a/src/test/regress/expected/role_priv.out b/src/test/regress/expected/role_priv.out
new file mode 100644
index 0000000000..22130af992
--- /dev/null
+++ b/src/test/regress/expected/role_priv.out
@@ -0,0 +1,1202 @@
+CREATE USER dba NOSUPERUSER;
+GRANT pg_manage_database_objects TO dba;
+CREATE USER noprivs NOSUPERUSER;
+CREATE USER superdba SUPERUSER;
+CREATE SCHEMA noprivs_schema;
+ALTER SCHEMA noprivs_schema OWNER TO noprivs;
+SET SESSION AUTHORIZATION superdba;
+CREATE AGGREGATE superdba_aggregate (
+   sfunc = int4_avg_accum,
+   basetype = int4,
+   stype = _int8,
+   finalfunc = int8_avg,
+   initcond1 = '{0,0}'
+);
+CREATE CAST (numeric AS text) WITHOUT FUNCTION;
+CREATE CAST (text AS numeric) WITH INOUT;
+CREATE COLLATION superdba_collation FROM "C";
+CREATE CONVERSION superdba_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
+CREATE DOMAIN superdba_domain numeric(8,2) CONSTRAINT superdba_domconstraint CHECK(VALUE != 42);
+CREATE FUNCTION superdba_event_trigger_func() RETURNS EVENT_TRIGGER AS $$ BEGIN RETURN; END; $$ LANGUAGE PLPGSQL;
+CREATE EVENT TRIGGER superdba_event_trigger_start ON ddl_command_start
+	WHEN TAG IN ('ALTER ACCESS METHOD')
+	EXECUTE FUNCTION superdba_event_trigger_func();
+CREATE EVENT TRIGGER superdba_event_trigger_end ON ddl_command_end
+	WHEN TAG IN ('ALTER FOREIGN TABLE')
+	EXECUTE FUNCTION superdba_event_trigger_func();
+CREATE EVENT TRIGGER superdba_event_trigger_rewrite ON table_rewrite
+	WHEN TAG IN ('ALTER TABLE')
+	EXECUTE FUNCTION superdba_event_trigger_func();
+CREATE EVENT TRIGGER superdba_event_trigger_drop ON sql_drop
+	WHEN TAG IN ('DROP INDEX')
+	EXECUTE FUNCTION superdba_event_trigger_func();
+CREATE SEQUENCE superdba_sequence;
+CREATE TABLE superdba_table (
+	id INTEGER DEFAULT nextval('superdba_sequence'),
+	id2 INTEGER GENERATED ALWAYS AS (length(str)) STORED,
+	id3 INTEGER GENERATED BY DEFAULT AS IDENTITY (NO CYCLE),
+	str TEXT,
+	ary INTEGER[],
+	adr INET,
+	CONSTRAINT superdba_constraint CHECK (length(str) < 100)
+);
+CREATE TABLE superdba_partitioned (
+	LIKE superdba_table
+) PARTITION BY RANGE (str COLLATE superdba_collation);
+CREATE TABLE superdba_partA_M PARTITION OF superdba_partitioned FOR VALUES FROM ('A') TO ('M');
+CREATE TABLE superdba_partM_Z PARTITION OF superdba_partitioned FOR VALUES FROM ('M') TO ('Z');
+CREATE INDEX superdba_index ON superdba_table (str);
+CREATE MATERIALIZED VIEW superdba_matview AS SELECT id, str, ary FROM superdba_table;
+CREATE POLICY superdba_policy ON superdba_table AS RESTRICTIVE;
+SET client_min_messages = 'ERROR';
+CREATE PUBLICATION superdba_publication FOR TABLE superdba_table;
+RESET client_min_messages;
+CREATE RULE superdba_rule AS ON UPDATE TO superdba_table DO INSTEAD NOTHING;
+CREATE SCHEMA superdba_schema;
+CREATE STATISTICS superdba_statistics ON (length(str)) FROM superdba_table;
+CREATE SUBSCRIPTION superdba_subscription CONNECTION 'dbname=none' PUBLICATION none WITH (connect = false, slot_name = NONE);
+WARNING:  tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
+CREATE TEXT SEARCH PARSER superdba_tsparser (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
+CREATE TEXT SEARCH TEMPLATE superdba_tstemplate (lexize=dsimple_lexize);
+CREATE TEXT SEARCH CONFIGURATION superdba_tsconfiguration (parser = superdba_tsparser);
+CREATE TEXT SEARCH DICTIONARY superdba_tsdictionary (template = superdba_tstemplate);
+CREATE TRANSFORM FOR bigint LANGUAGE SQL (
+    FROM SQL WITH FUNCTION prsd_lextype(internal),
+    TO SQL WITH FUNCTION int8recv(internal));
+CREATE FUNCTION superdba_trigger_func() RETURNS trigger AS $$ BEGIN RETURN NEW; END; $$ LANGUAGE PLPGSQL;
+CREATE TRIGGER superdba_trigger BEFORE INSERT ON superdba_table EXECUTE FUNCTION superdba_trigger_func();
+CREATE TYPE superdba_type AS ENUM ('charge', 'charm', 'color', 'mass', 'spin');
+CREATE FUNCTION superdba_type_eq (leftarg superdba_type, rightarg superdba_type) RETURNS BOOLEAN AS $$
+	SELECT $1::text = $2::text;
+$$ LANGUAGE sql;
+CREATE OPERATOR === (
+	FUNCTION = superdba_type_eq,
+	LEFTARG = superdba_type,
+	RIGHTARG = superdba_type
+);
+CREATE PROCEDURE superdba_procedure (t superdba_type) AS $$ BEGIN RETURN; END; $$ LANGUAGE PLPGSQL;
+CREATE VIEW superdba_view AS SELECT str, ary FROM superdba_table;
+RESET SESSION AUTHORIZATION;
+-- create objects owned by unprivileged user "noprivs"
+SET SESSION AUTHORIZATION noprivs;
+CREATE AGGREGATE noprivs_aggregate (
+   sfunc = int4_avg_accum,
+   basetype = int4,
+   stype = _int8,
+   finalfunc = int8_avg,
+   initcond1 = '{0,0}'
+);
+CREATE CAST (timestamp AS tsquery) WITHOUT FUNCTION;
+ERROR:  must be owner of type timestamp without time zone or type tsquery
+CREATE CAST (tsquery AS timestamp) WITH INOUT;
+ERROR:  must be owner of type tsquery or type timestamp without time zone
+CREATE COLLATION noprivs_collation FROM "C";
+CREATE CONVERSION noprivs_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
+CREATE DOMAIN noprivs_domain numeric(10,4) CONSTRAINT noprivs_domconstraint CHECK(VALUE != 42);
+CREATE FUNCTION noprivs_event_trigger_func() RETURNS EVENT_TRIGGER AS $$ BEGIN RETURN; END; $$ LANGUAGE PLPGSQL;
+CREATE EVENT TRIGGER noprivs_event_trigger_start ON ddl_command_start
+	WHEN TAG IN ('REVOKE')
+	EXECUTE FUNCTION noprivs_event_trigger_func();
+ERROR:  permission denied to create event trigger "noprivs_event_trigger_start"
+HINT:  Must be superuser to create an event trigger.
+CREATE EVENT TRIGGER noprivs_event_trigger_end ON ddl_command_end
+	WHEN TAG IN ('SECURITY LABLE')
+	EXECUTE FUNCTION noprivs_event_trigger_func();
+ERROR:  permission denied to create event trigger "noprivs_event_trigger_end"
+HINT:  Must be superuser to create an event trigger.
+CREATE EVENT TRIGGER noprivs_event_trigger_rewrite ON table_rewrite
+	WHEN TAG IN ('ALTER TABLE')
+	EXECUTE FUNCTION noprivs_event_trigger_func();
+ERROR:  permission denied to create event trigger "noprivs_event_trigger_rewrite"
+HINT:  Must be superuser to create an event trigger.
+CREATE EVENT TRIGGER noprivs_event_trigger_drop ON sql_drop
+	WHEN TAG IN ('DROP TRANSFORM')
+	EXECUTE FUNCTION noprivs_event_trigger_func();
+ERROR:  permission denied to create event trigger "noprivs_event_trigger_drop"
+HINT:  Must be superuser to create an event trigger.
+CREATE SEQUENCE noprivs_sequence;
+CREATE TABLE noprivs_table (
+	id INTEGER DEFAULT nextval('noprivs_sequence'),
+	id2 INTEGER GENERATED ALWAYS AS (length(str)) STORED,
+	id3 INTEGER GENERATED BY DEFAULT AS IDENTITY (NO CYCLE),
+	str TEXT,
+	ary INTEGER[],
+	adr INET,
+	CONSTRAINT noprivs_constraint CHECK (length(str) < 100)
+);
+CREATE TABLE noprivs_partitioned (
+	LIKE noprivs_table
+) PARTITION BY RANGE (str COLLATE noprivs_collation);
+CREATE TABLE noprivs_partA_M PARTITION OF noprivs_partitioned FOR VALUES FROM ('A') TO ('M');
+CREATE TABLE noprivs_partM_Z PARTITION OF noprivs_partitioned FOR VALUES FROM ('M') TO ('Z');
+CREATE INDEX noprivs_index ON noprivs_table (str);
+CREATE MATERIALIZED VIEW noprivs_matview AS SELECT id, str, ary FROM noprivs_table;
+CREATE POLICY noprivs_policy ON noprivs_table AS RESTRICTIVE;
+SET client_min_messages = 'ERROR';
+CREATE PUBLICATION noprivs_publication FOR TABLE noprivs_table;
+ERROR:  permission denied for database regression
+RESET client_min_messages;
+CREATE RULE noprivs_rule AS ON UPDATE TO noprivs_table DO INSTEAD NOTHING;
+CREATE SCHEMA noprivs_schema;
+ERROR:  permission denied for database regression
+CREATE STATISTICS noprivs_statistics ON (length(str)) FROM noprivs_table;
+CREATE SUBSCRIPTION noprivs_subscription CONNECTION 'dbname=none' PUBLICATION none WITH (connect = false, slot_name = NONE);
+ERROR:  must be superuser to create subscriptions
+CREATE TEXT SEARCH PARSER noprivs_tsparser (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
+ERROR:  must be superuser to create text search parsers
+CREATE TEXT SEARCH TEMPLATE noprivs_tstemplate (lexize=dsimple_lexize);
+ERROR:  must be superuser to create text search templates
+CREATE TEXT SEARCH CONFIGURATION noprivs_tsconfiguration (parser = superdba_tsparser);
+CREATE TEXT SEARCH DICTIONARY noprivs_tsdictionary (template = superdba_tstemplate);
+CREATE TRANSFORM FOR int2 LANGUAGE SQL (
+    FROM SQL WITH FUNCTION prsd_lextype(internal),
+    TO SQL WITH FUNCTION int8recv(internal));
+ERROR:  must be owner of type smallint
+CREATE FUNCTION noprivs_trigger_func() RETURNS trigger AS $$ BEGIN RETURN NEW; END; $$ LANGUAGE PLPGSQL;
+CREATE TRIGGER noprivs_trigger BEFORE INSERT ON noprivs_table EXECUTE FUNCTION noprivs_trigger_func();
+CREATE TYPE noprivs_type AS ENUM ('charge', 'charm', 'color', 'mass', 'spin');
+CREATE FUNCTION noprivs_type_eq (leftarg noprivs_type, rightarg noprivs_type) RETURNS BOOLEAN AS $$
+	SELECT $1::text = $2::text;
+$$ LANGUAGE sql;
+CREATE OPERATOR === (
+	FUNCTION = noprivs_type_eq,
+	LEFTARG = noprivs_type,
+	RIGHTARG = noprivs_type
+);
+CREATE PROCEDURE noprivs_procedure (t noprivs_type) AS $$ BEGIN RETURN; END; $$ LANGUAGE PLPGSQL;
+CREATE VIEW noprivs_view AS SELECT str, ary FROM noprivs_table;
+RESET SESSION AUTHORIZATION;
+-- Check permissions for dba who has pg_manage_database_objects membership
+SET SESSION AUTHORIZATION dba;
+-- attempt to alter system built-in objects
+ALTER AGGREGATE pg_catalog.avg(int8) RENAME TO avg_renamed;
+ERROR:  must be owner of function avg
+ALTER AGGREGATE pg_catalog.avg(int8) OWNER TO noprivs;
+ERROR:  must be owner of function avg
+ALTER AGGREGATE pg_catalog.avg(int8) OWNER TO dba;
+ERROR:  must be owner of function avg
+ALTER AGGREGATE pg_catalog.avg(int8) OWNER TO superdba;
+ERROR:  must be owner of function avg
+ALTER AGGREGATE pg_catalog.avg(int8) SET SCHEMA noprivs_schema;
+ERROR:  must be owner of function avg
+ALTER TABLE pg_catalog.pg_class RENAME COLUMN relname TO relname_renamed;
+ERROR:  must be owner of table pg_class
+ALTER TABLE pg_catalog.pg_class ADD COLUMN othercolumn TEXT;
+ERROR:  must be owner of table pg_class
+ALTER TABLE pg_catalog.pg_class DROP COLUMN reloptions;
+ERROR:  must be owner of table pg_class
+ALTER TABLE pg_catalog.pg_class ALTER COLUMN relpartbound SET STATISTICS 200;
+ERROR:  must be owner of table pg_class
+ALTER TABLE pg_catalog.pg_class ALTER COLUMN relpartbound SET COMPRESSION pglz;
+ERROR:  must be owner of table pg_class
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 RENAME TO utf8_to_iso_8859_1_renamed;
+ERROR:  must be owner of conversion utf8_to_iso_8859_1
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 OWNER TO noprivs;
+ERROR:  must be owner of conversion utf8_to_iso_8859_1
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 OWNER TO dba;
+ERROR:  must be owner of conversion utf8_to_iso_8859_1
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 OWNER TO superdba;
+ERROR:  must be owner of conversion utf8_to_iso_8859_1
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 SET SCHEMA noprivs_schema;
+ERROR:  must be owner of conversion utf8_to_iso_8859_1
+ALTER DOMAIN information_schema.cardinal_number SET DEFAULT 0;
+ERROR:  must be owner of type information_schema.cardinal_number
+ALTER DOMAIN information_schema.cardinal_number SET NOT NULL;
+ERROR:  must be owner of type information_schema.cardinal_number
+ALTER DOMAIN information_schema.cardinal_number ADD CHECK (VALUE >= 0);
+ERROR:  must be owner of type information_schema.cardinal_number
+ALTER DOMAIN information_schema.cardinal_number RENAME TO cardinal_number_renamed;
+ERROR:  must be owner of type information_schema.cardinal_number
+ALTER DOMAIN information_schema.cardinal_number OWNER TO noprivs;
+ERROR:  must be owner of type information_schema.cardinal_number
+ALTER DOMAIN information_schema.cardinal_number OWNER TO dba;
+ERROR:  must be owner of type information_schema.cardinal_number
+ALTER DOMAIN information_schema.cardinal_number OWNER TO superdba;
+ERROR:  must be owner of type information_schema.cardinal_number
+ALTER DOMAIN information_schema.cardinal_number SET SCHEMA noprivs_schema;
+ERROR:  must be owner of type information_schema.cardinal_number
+ALTER EXTENSION plpgsql UPDATE TO 'bogus_plpgsql_version';
+ERROR:  must be owner of extension plpgsql
+ALTER EXTENSION plpgsql SET SCHEMA noprivs_schema;
+ERROR:  must be owner of extension plpgsql
+ALTER EXTENSION plpgsql ADD TABLE pg_catalog.pg_class;
+ERROR:  must be owner of extension plpgsql
+ALTER EXTENSION plpgsql DROP TABLE pg_catalog.pg_class;
+ERROR:  must be owner of extension plpgsql
+ALTER RULE pg_settings_u ON pg_catalog.pg_settings RENAME TO pg_settings_u_renamed;
+ERROR:  must be owner of view pg_settings
+ALTER RULE pg_settings_u_renamed ON pg_catalog.pg_settings RENAME TO pg_settings_u;
+ERROR:  must be owner of view pg_settings
+ALTER SCHEMA information_schema OWNER TO noprivs;
+ERROR:  must be owner of schema information_schema
+ALTER SCHEMA information_schema OWNER TO dba;
+ERROR:  must be owner of schema information_schema
+ALTER SCHEMA information_schema OWNER TO superdba;
+ERROR:  must be owner of schema information_schema
+ALTER SCHEMA information_schema RENAME TO information_schema_renamed;
+ERROR:  must be owner of schema information_schema
+ALTER TABLE information_schema.sql_features RENAME TO sql_features_renamed;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features OWNER TO noprivs;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features OWNER TO dba;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features OWNER TO superdba;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features DISABLE ROW LEVEL SECURITY;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features ENABLE ROW LEVEL SECURITY;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features FORCE ROW LEVEL SECURITY;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features NO FORCE ROW LEVEL SECURITY;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features CLUSTER ON superdba_index;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features SET WITHOUT CLUSTER;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features SET WITHOUT OIDS;
+ERROR:  must be owner of table sql_features
+ALTER TABLE information_schema.sql_features SET SCHEMA noprivs_schema;
+ERROR:  must be owner of table sql_features
+ALTER VIEW information_schema.foreign_table_options ALTER COLUMN foreign_table_name SET DEFAULT 'something';
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options ALTER COLUMN foreign_table_name DROP DEFAULT;
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options OWNER TO noprivs;
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options OWNER TO dba;
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options OWNER TO superdba;
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options RENAME COLUMN foreign_table_name TO foreign_table_name_renamed;
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options RENAME COLUMN foreign_table_name_renamed TO foreign_table_name;
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options RENAME TO foreign_table_options_renamed;
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options SET SCHEMA noprivs_schema;
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options SET (check_option = local);
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options SET (check_option = cascaded);
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options RESET (check_option);
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options SET (security_barrier = on);
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options SET (security_barrier = off);
+ERROR:  must be owner of view foreign_table_options
+ALTER VIEW information_schema.foreign_table_options RESET (security_barrier);
+ERROR:  must be owner of view foreign_table_options
+-- attempt to alter objects owned by superdba
+ALTER AGGREGATE public.superdba_aggregate(int4) RENAME TO superdba_aggregate_renamed;
+ERROR:  must be owner of function superdba_aggregate
+ALTER AGGREGATE public.superdba_aggregate(int4) OWNER TO noprivs;
+ERROR:  must be owner of function superdba_aggregate
+ALTER AGGREGATE public.superdba_aggregate(int4) OWNER TO dba;
+ERROR:  must be owner of function superdba_aggregate
+ALTER AGGREGATE public.superdba_aggregate(int4) OWNER TO superdba;
+ALTER AGGREGATE public.superdba_aggregate(int4) SET SCHEMA noprivs_schema;
+ERROR:  must be owner of function superdba_aggregate
+ALTER COLLATION public.superdba_collation RENAME TO superdba_collation_renamed;
+ERROR:  must be owner of collation superdba_collation
+ALTER COLLATION public.superdba_collation OWNER TO noprivs;
+ERROR:  must be owner of collation superdba_collation
+ALTER COLLATION public.superdba_collation OWNER TO dba;
+ERROR:  must be owner of collation superdba_collation
+ALTER COLLATION public.superdba_collation OWNER TO superdba;
+ALTER COLLATION public.superdba_collation SET SCHEMA noprivs_schema;
+ERROR:  must be owner of collation superdba_collation
+ALTER CONVERSION public.superdba_conversion RENAME TO superdba_conversion_renamed;
+ERROR:  must be owner of conversion superdba_conversion
+ALTER CONVERSION public.superdba_conversion OWNER TO noprivs;
+ERROR:  must be owner of conversion superdba_conversion
+ALTER CONVERSION public.superdba_conversion OWNER TO dba;
+ERROR:  must be owner of conversion superdba_conversion
+ALTER CONVERSION public.superdba_conversion OWNER TO superdba;
+ALTER CONVERSION public.superdba_conversion SET SCHEMA noprivs_schema;
+ERROR:  must be owner of conversion superdba_conversion
+ALTER DOMAIN public.superdba_domain SET DEFAULT 0;
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain SET NOT NULL;
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain ADD CHECK (VALUE >= 0);
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain RENAME TO superdba_domain_renamed;
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain OWNER TO noprivs;
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain OWNER TO dba;
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain OWNER TO superdba;
+ALTER DOMAIN public.superdba_domain SET SCHEMA noprivs_schema;
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain RENAME CONSTRAINT superdba_domconstraint TO superdba_domconstraint_renamed;
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain ADD CONSTRAINT otherconstraint CHECK (VALUE != 5);
+ERROR:  must be owner of type superdba_domain
+ALTER DOMAIN public.superdba_domain DROP CONSTRAINT otherconstraint;
+ERROR:  must be owner of type superdba_domain
+ALTER EVENT TRIGGER superdba_event_trigger_start DISABLE;
+ERROR:  must be owner of event trigger superdba_event_trigger_start
+ALTER EVENT TRIGGER superdba_event_trigger_start ENABLE;
+ERROR:  must be owner of event trigger superdba_event_trigger_start
+ALTER EVENT TRIGGER superdba_event_trigger_end ENABLE REPLICA;
+ERROR:  must be owner of event trigger superdba_event_trigger_end
+ALTER EVENT TRIGGER superdba_event_trigger_end ENABLE ALWAYS;
+ERROR:  must be owner of event trigger superdba_event_trigger_end
+ALTER EVENT TRIGGER superdba_event_trigger_rewrite OWNER TO noprivs;
+ERROR:  must be owner of event trigger superdba_event_trigger_rewrite
+ALTER EVENT TRIGGER superdba_event_trigger_rewrite OWNER TO dba;
+ERROR:  must be owner of event trigger superdba_event_trigger_rewrite
+ALTER EVENT TRIGGER superdba_event_trigger_rewrite OWNER TO superdba;
+ALTER EVENT TRIGGER superdba_event_trigger_drop RENAME TO superdba_event_trigger_drop_renamed;
+ERROR:  must be owner of event trigger superdba_event_trigger_drop
+ALTER MATERIALIZED VIEW public.superdba_matview SET SCHEMA noprivs_schema;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview RENAME TO superdba_matview_renamed;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview RENAME ary TO ary_renamed;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview ALTER str SET STATISTICS 20;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview ALTER str SET STORAGE external;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview ALTER str SET COMPRESSION pglz;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview SET WITHOUT CLUSTER;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview OWNER TO noprivs;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview OWNER TO dba;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER MATERIALIZED VIEW public.superdba_matview OWNER TO superdba;
+ERROR:  must be owner of materialized view superdba_matview
+ALTER POLICY superdba_policy ON public.superdba_table RENAME TO superdba_policy_renamed;
+ERROR:  must be owner of table superdba_table
+ALTER PUBLICATION superdba_publication DROP TABLE superdba_table;
+ERROR:  must be owner of publication superdba_publication
+ALTER PUBLICATION superdba_publication SET (publish = insert);
+ERROR:  must be owner of publication superdba_publication
+ALTER PUBLICATION superdba_publication OWNER TO noprivs;
+ERROR:  must be owner of publication superdba_publication
+ALTER PUBLICATION superdba_publication OWNER TO dba;
+ERROR:  must be owner of publication superdba_publication
+ALTER PUBLICATION superdba_publication OWNER TO superdba;
+ALTER PUBLICATION superdba_publication RENAME TO superdba_publication_renamed;
+ERROR:  must be owner of publication superdba_publication
+ALTER RULE superdba_rule ON public.superdba_table RENAME TO superdba_rule_renamed;
+ERROR:  must be owner of table superdba_table
+ALTER SCHEMA superdba_schema OWNER TO noprivs;
+ERROR:  must be owner of schema superdba_schema
+ALTER SCHEMA superdba_schema OWNER TO dba;
+ERROR:  must be owner of schema superdba_schema
+ALTER SCHEMA superdba_schema OWNER TO superdba;
+ALTER SCHEMA superdba_schema RENAME TO superdba_schema_renamed;
+ERROR:  must be owner of schema superdba_schema
+ALTER SEQUENCE public.superdba_sequence RESTART;
+ERROR:  must be owner of sequence superdba_sequence
+ALTER SEQUENCE public.superdba_sequence INCREMENT BY 3;
+ERROR:  must be owner of sequence superdba_sequence
+ALTER SEQUENCE public.superdba_sequence OWNER TO noprivs;
+ERROR:  must be owner of sequence superdba_sequence
+ALTER SEQUENCE public.superdba_sequence OWNER TO dba;
+ERROR:  must be owner of sequence superdba_sequence
+ALTER SEQUENCE public.superdba_sequence OWNER TO superdba;
+ERROR:  must be owner of sequence superdba_sequence
+ALTER SEQUENCE public.superdba_sequence SET SCHEMA noprivs_schema;
+ERROR:  must be owner of sequence superdba_sequence
+ALTER SEQUENCE public.superdba_sequence RENAME TO superdba_sequence_renamed;
+ERROR:  must be owner of sequence superdba_sequence
+ALTER STATISTICS public.superdba_statistics SET STATISTICS 10000;
+ERROR:  must be owner of statistics object public.superdba_statistics
+ALTER STATISTICS public.superdba_statistics OWNER TO noprivs;
+ERROR:  must be owner of statistics object superdba_statistics
+ALTER STATISTICS public.superdba_statistics OWNER TO dba;
+ERROR:  must be owner of statistics object superdba_statistics
+ALTER STATISTICS public.superdba_statistics OWNER TO superdba;
+ALTER STATISTICS public.superdba_statistics RENAME TO superdba_statistics_renamed;
+ERROR:  must be owner of statistics object superdba_statistics
+ALTER STATISTICS public.superdba_statistics SET SCHEMA noprivs_schema;
+ERROR:  must be owner of statistics object superdba_statistics
+ALTER SUBSCRIPTION superdba_subscription CONNECTION 'dbname=other';
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET PUBLICATION otherpub;
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription ADD PUBLICATION anotherpub;
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription DROP PUBLICATION andere;
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription DISABLE;
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (slot_name = otherslot);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = remote_apply);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = on);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = remote_write);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = local);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = off);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (binary = on);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (binary = off);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (streaming = on);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription SET (streaming = off);
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription OWNER TO noprivs;
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription OWNER TO dba;
+ERROR:  must be owner of subscription superdba_subscription
+ALTER SUBSCRIPTION superdba_subscription OWNER TO superdba;
+ALTER SUBSCRIPTION superdba_subscription RENAME TO superdba_subscription_renamed;
+ERROR:  must be owner of subscription superdba_subscription
+ALTER TABLE public.superdba_table RENAME COLUMN str TO str_renamed;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table ADD COLUMN othercolumn TEXT;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table DROP COLUMN othercolumn;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table DROP COLUMN adr;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table ADD COLUMN adr INET;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table ALTER COLUMN ary SET STATISTICS 200;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table ALTER COLUMN ary SET COMPRESSION pglz;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table VALIDATE CONSTRAINT superdba_constraint;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table DISABLE ROW LEVEL SECURITY;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table ENABLE ROW LEVEL SECURITY;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table FORCE ROW LEVEL SECURITY;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table NO FORCE ROW LEVEL SECURITY;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table CLUSTER ON superdba_index;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table SET WITHOUT CLUSTER;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table SET WITHOUT OIDS;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table RENAME TO superdba_table_renamed;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table OWNER TO noprivs;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table OWNER TO dba;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table OWNER TO superdba;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table SET SCHEMA noprivs_schema;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_table SET TABLESPACE pg_global;
+ERROR:  must be owner of table superdba_table
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION pg_catalog.pg_class FOR VALUES FROM ('0') TO ('9');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_table FOR VALUES FROM ('0') TO ('9');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.superdba_table;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.superdba_partA_M;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned INHERIT public.superdba_table;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned NO INHERIT public.superdba_table;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned REPLICA IDENTITY FULL;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned REPLICA IDENTITY NOTHING;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partM_Z ATTACH PARTITION public.superdba_table FOR VALUES FROM ('0') TO ('9');
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.superdba_partM_Z DETACH PARTITION public.superdba_table;
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.superdba_partM_Z DETACH PARTITION public.superdba_partA_M;
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.superdba_partM_Z ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.superdba_partM_Z INHERIT public.superdba_table;
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.superdba_partM_Z NO INHERIT public.superdba_table;
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.superdba_partM_Z REPLICA IDENTITY FULL;
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.superdba_partM_Z REPLICA IDENTITY NOTHING;
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.noprivs_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.noprivs_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.superdba_partA_M;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.superdba_partA_M;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.noprivs_partA_M;
+ERROR:  must be owner of table superdba_partitioned
+ALTER TEXT SEARCH PARSER public.superdba_tsparser SET SCHEMA noprivs_schema;
+ERROR:  must be superuser to set schema of text search parser superdba_tsparser
+ALTER TEXT SEARCH PARSER public.superdba_tsparser RENAME TO superdba_tsparser_renamed;
+ERROR:  must be superuser to rename text search parser superdba_tsparser
+ALTER TEXT SEARCH TEMPLATE public.superdba_tstemplate SET SCHEMA noprivs_schema;
+ERROR:  must be superuser to set schema of text search template superdba_tstemplate
+ALTER TEXT SEARCH TEMPLATE public.superdba_tstemplate RENAME TO superdba_tstemplate_renamed;
+ERROR:  must be superuser to rename text search template superdba_tstemplate
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration OWNER TO noprivs;
+ERROR:  must be owner of text search configuration superdba_tsconfiguration
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration OWNER TO dba;
+ERROR:  must be owner of text search configuration superdba_tsconfiguration
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration OWNER TO superdba;
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration SET SCHEMA noprivs_schema;
+ERROR:  must be owner of text search configuration superdba_tsconfiguration
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration RENAME TO superdba_tsconfiguration_renamed;
+ERROR:  must be owner of text search configuration superdba_tsconfiguration
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary OWNER TO noprivs;
+ERROR:  must be owner of text search dictionary superdba_tsdictionary
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary OWNER TO dba;
+ERROR:  must be owner of text search dictionary superdba_tsdictionary
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary OWNER TO superdba;
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary SET SCHEMA noprivs_schema;
+ERROR:  must be owner of text search dictionary superdba_tsdictionary
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary RENAME TO superdba_tsdictionary_renamed;
+ERROR:  must be owner of text search dictionary superdba_tsdictionary
+ALTER TRIGGER superdba_trigger ON public.superdba_table RENAME TO superdba_trigger_renamed;
+ERROR:  must be owner of table superdba_table
+ALTER TRIGGER superdba_trigger ON public.superdba_table DEPENDS ON EXTENSION plpgsql;
+ERROR:  must be owner of relation superdba_table
+ALTER TRIGGER superdba_trigger ON public.superdba_table NO DEPENDS ON EXTENSION plpgsql;
+ERROR:  must be owner of relation superdba_table
+ALTER TYPE public.superdba_type OWNER TO noprivs;
+ERROR:  must be owner of type superdba_type
+ALTER TYPE public.superdba_type OWNER TO dba;
+ERROR:  must be owner of type superdba_type
+ALTER TYPE public.superdba_type OWNER TO superdba;
+ALTER TYPE public.superdba_type RENAME TO superdba_type_renamed;
+ERROR:  must be owner of type superdba_type
+ALTER TYPE public.superdba_type SET SCHEMA noprivs_schema;
+ERROR:  must be owner of type superdba_type
+ALTER TYPE public.superdba_type ADD VALUE 'strange';
+ERROR:  must be owner of type superdba_type
+ALTER TYPE public.superdba_type RENAME VALUE 'spin' TO 'twist';
+ERROR:  must be owner of type superdba_type
+ALTER TYPE public.superdba_type SET ( ANALYZE = none );
+ERROR:  must be superuser to alter a type
+ALTER TYPE public.superdba_type SET ( SUBSCRIPT = none );
+ERROR:  must be superuser to alter a type
+ALTER TYPE public.superdba_type SET ( STORAGE = plain );
+ERROR:  must be owner of type superdba_type
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) OWNER TO noprivs;
+ERROR:  must be owner of function superdba_procedure
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) OWNER TO dba;
+ERROR:  must be owner of function superdba_procedure
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) OWNER TO superdba;
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) SET SCHEMA noprivs_schema;
+ERROR:  must be owner of function superdba_procedure
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) RENAME TO superdba_procedure_renamed;
+ERROR:  must be owner of function superdba_procedure
+ALTER VIEW public.superdba_view ALTER COLUMN str SET DEFAULT 'otherstr';
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view ALTER COLUMN str DROP DEFAULT;
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view OWNER TO noprivs;
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view OWNER TO dba;
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view OWNER TO superdba;
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view RENAME COLUMN ary TO ary_renamed;
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view RENAME TO superdba_view_renamed;
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view SET SCHEMA noprivs_schema;
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view SET (check_option = local);
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view SET (check_option = cascaded);
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view RESET (check_option);
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view SET (security_barrier = on);
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view SET (security_barrier = off);
+ERROR:  must be owner of view superdba_view
+ALTER VIEW public.superdba_view RESET (security_barrier);
+ERROR:  must be owner of view superdba_view
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) OWNER TO noprivs;
+ERROR:  must be owner of function superdba_type_eq
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) OWNER TO dba;
+ERROR:  must be owner of function superdba_type_eq
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) OWNER TO superdba;
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) SET SCHEMA noprivs_schema;
+ERROR:  must be owner of function superdba_type_eq
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) DEPENDS ON EXTENSION plpgsql;
+ERROR:  must be owner of function public.superdba_type_eq
+ALTER OPERATOR public.=== (superdba_type, superdba_type) OWNER TO noprivs;
+ERROR:  must be owner of operator ===
+ALTER OPERATOR public.=== (superdba_type, superdba_type) OWNER TO dba;
+ERROR:  must be owner of operator ===
+ALTER OPERATOR public.=== (superdba_type, superdba_type) OWNER TO superdba;
+ALTER OPERATOR public.=== (superdba_type, superdba_type) SET SCHEMA noprivs_schema;
+ERROR:  must be owner of operator ===
+-- attempt to alter objects owned by unprivileged user "noprivs"
+ALTER AGGREGATE public.noprivs_aggregate(int4) RENAME TO noprivs_aggregate_renamed;
+ALTER AGGREGATE public.noprivs_aggregate_renamed(int4) RENAME TO noprivs_aggregate;
+ALTER AGGREGATE public.noprivs_aggregate(int4) OWNER TO noprivs;
+ALTER AGGREGATE public.noprivs_aggregate(int4) OWNER TO dba;
+ALTER AGGREGATE public.noprivs_aggregate(int4) OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER AGGREGATE public.noprivs_aggregate(int4) SET SCHEMA noprivs_schema;
+ALTER AGGREGATE noprivs_schema.noprivs_aggregate(int4) SET SCHEMA public;
+ALTER COLLATION public.noprivs_collation RENAME TO noprivs_collation_renamed;
+ALTER COLLATION public.noprivs_collation_renamed RENAME TO noprivs_collation;
+ALTER COLLATION public.noprivs_collation OWNER TO dba;
+ALTER COLLATION public.noprivs_collation OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER COLLATION public.noprivs_collation OWNER TO noprivs;
+ALTER COLLATION public.noprivs_collation SET SCHEMA noprivs_schema;
+ALTER COLLATION noprivs_schema.noprivs_collation SET SCHEMA public;
+ALTER CONVERSION public.noprivs_conversion RENAME TO noprivs_conversion_renamed;
+ALTER CONVERSION public.noprivs_conversion_renamed RENAME TO noprivs_conversion;
+ALTER CONVERSION public.noprivs_conversion OWNER TO dba;
+ALTER CONVERSION public.noprivs_conversion OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER CONVERSION public.noprivs_conversion OWNER TO noprivs;
+ALTER CONVERSION public.noprivs_conversion SET SCHEMA noprivs_schema;
+ALTER CONVERSION noprivs_schema.noprivs_conversion SET SCHEMA public;
+ALTER DOMAIN public.noprivs_domain SET DEFAULT 0;
+ALTER DOMAIN public.noprivs_domain SET NOT NULL;
+ALTER DOMAIN public.noprivs_domain ADD CHECK (VALUE >= 0);
+ALTER DOMAIN public.noprivs_domain RENAME TO noprivs_domain_renamed;
+ALTER DOMAIN public.noprivs_domain_renamed RENAME TO noprivs_domain;
+ALTER DOMAIN public.noprivs_domain OWNER TO dba;
+ALTER DOMAIN public.noprivs_domain OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER DOMAIN public.noprivs_domain OWNER TO noprivs;
+ALTER DOMAIN public.noprivs_domain SET SCHEMA noprivs_schema;
+ALTER DOMAIN noprivs_schema.noprivs_domain SET SCHEMA public;
+ALTER DOMAIN public.noprivs_domain RENAME CONSTRAINT noprivs_domconstraint TO noprivs_domconstraint_renamed;
+ALTER DOMAIN public.noprivs_domain RENAME CONSTRAINT noprivs_domconstraint_renamed TO noprivs_domconstraint;
+ALTER DOMAIN public.noprivs_domain ADD CONSTRAINT otherconstraint CHECK (VALUE != 5);
+ALTER DOMAIN public.noprivs_domain DROP CONSTRAINT otherconstraint;
+ALTER MATERIALIZED VIEW public.noprivs_matview SET SCHEMA noprivs_schema;
+ALTER MATERIALIZED VIEW noprivs_schema.noprivs_matview SET SCHEMA public;
+ALTER MATERIALIZED VIEW public.noprivs_matview RENAME TO noprivs_matview_renamed;
+ALTER MATERIALIZED VIEW public.noprivs_matview_renamed RENAME TO noprivs_matview;
+ALTER MATERIALIZED VIEW public.noprivs_matview RENAME ary TO ary_renamed;
+ALTER MATERIALIZED VIEW public.noprivs_matview RENAME ary_renamed TO ary;
+ALTER MATERIALIZED VIEW public.noprivs_matview ALTER str SET STATISTICS 20;
+ALTER MATERIALIZED VIEW public.noprivs_matview ALTER str SET STORAGE external;
+ALTER MATERIALIZED VIEW public.noprivs_matview ALTER str SET COMPRESSION pglz;
+ALTER MATERIALIZED VIEW public.noprivs_matview SET WITHOUT CLUSTER;
+ALTER MATERIALIZED VIEW public.noprivs_matview OWNER TO dba;
+ALTER MATERIALIZED VIEW public.noprivs_matview OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER MATERIALIZED VIEW public.noprivs_matview OWNER TO noprivs;
+ALTER POLICY noprivs_policy ON noprivs_table RENAME TO noprivs_policy_renamed;
+ALTER POLICY noprivs_policy_renamed ON noprivs_table RENAME TO noprivs_policy;
+ALTER RULE noprivs_rule ON public.noprivs_table RENAME TO noprivs_rule_renamed;
+ALTER RULE noprivs_rule_renamed ON public.noprivs_table RENAME TO noprivs_rule;
+ALTER SCHEMA noprivs_schema OWNER TO dba;
+ALTER SCHEMA noprivs_schema OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER SCHEMA noprivs_schema OWNER TO noprivs;
+ALTER SCHEMA noprivs_schema RENAME TO noprivs_schema_renamed;
+ALTER SCHEMA noprivs_schema_renamed RENAME TO noprivs_schema;
+ALTER SEQUENCE public.noprivs_sequence RESTART;
+ALTER SEQUENCE public.noprivs_sequence INCREMENT BY 3;
+ALTER SEQUENCE public.noprivs_sequence OWNER TO dba;
+ALTER SEQUENCE public.noprivs_sequence OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER SEQUENCE public.noprivs_sequence OWNER TO noprivs;
+ALTER SEQUENCE public.noprivs_sequence SET SCHEMA noprivs_schema;
+ALTER SEQUENCE noprivs_schema.noprivs_sequence SET SCHEMA public;;
+ALTER SEQUENCE public.noprivs_sequence RENAME TO noprivs_sequence_renamed;
+ALTER SEQUENCE public.noprivs_sequence_renamed RENAME TO noprivs_sequence;
+ALTER STATISTICS public.noprivs_statistics SET STATISTICS 10000;
+ALTER STATISTICS public.noprivs_statistics OWNER TO dba;
+ALTER STATISTICS public.noprivs_statistics OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER STATISTICS public.noprivs_statistics OWNER TO noprivs;
+ALTER STATISTICS public.noprivs_statistics RENAME TO noprivs_statistics_renamed;
+ALTER STATISTICS public.noprivs_statistics_renamed RENAME TO noprivs_statistics;
+ALTER STATISTICS public.noprivs_statistics SET SCHEMA noprivs_schema;
+ALTER STATISTICS noprivs_schema.noprivs_statistics SET SCHEMA public;
+ALTER TABLE public.noprivs_table RENAME COLUMN str TO str_renamed;
+ALTER TABLE public.noprivs_table RENAME COLUMN str_renamed TO str;
+ALTER TABLE public.noprivs_table ADD COLUMN othercolumn TEXT;
+ALTER TABLE public.noprivs_table DROP COLUMN othercolumn;
+ALTER TABLE public.noprivs_table DROP COLUMN adr;
+ALTER TABLE public.noprivs_table ADD COLUMN adr INET;
+ALTER TABLE public.noprivs_table ALTER COLUMN ary SET STATISTICS 200;
+ALTER TABLE public.noprivs_table ALTER COLUMN ary SET COMPRESSION pglz;
+ALTER TABLE public.noprivs_table VALIDATE CONSTRAINT noprivs_constraint;
+ALTER TABLE public.noprivs_table DISABLE ROW LEVEL SECURITY;
+ALTER TABLE public.noprivs_table ENABLE ROW LEVEL SECURITY;
+ALTER TABLE public.noprivs_table FORCE ROW LEVEL SECURITY;
+ALTER TABLE public.noprivs_table NO FORCE ROW LEVEL SECURITY;
+ALTER TABLE public.noprivs_table CLUSTER ON noprivs_index;
+ALTER TABLE public.noprivs_table SET WITHOUT CLUSTER;
+ALTER TABLE public.noprivs_table SET WITHOUT OIDS;
+ALTER TABLE public.noprivs_table RENAME TO noprivs_table_renamed;
+ALTER TABLE public.noprivs_table_renamed RENAME TO noprivs_table;
+ALTER TABLE public.noprivs_table OWNER TO dba;
+ALTER TABLE public.noprivs_table OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER TABLE public.noprivs_table OWNER TO noprivs;
+ALTER TABLE public.noprivs_table SET SCHEMA noprivs_schema;
+ALTER TABLE noprivs_schema.noprivs_table SET SCHEMA public;
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION pg_catalog.pg_class FOR VALUES FROM ('0') TO ('9');
+ERROR:  must be owner of table pg_class
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.noprivs_table FOR VALUES FROM ('0') TO ('9');
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.noprivs_table;
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.noprivs_partA_M;
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.noprivs_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.noprivs_partitioned INHERIT public.noprivs_table;
+ERROR:  cannot change inheritance of partitioned table
+ALTER TABLE public.noprivs_partitioned NO INHERIT public.noprivs_table;
+ERROR:  relation "noprivs_table" is not a parent of relation "noprivs_partitioned"
+ALTER TABLE public.noprivs_partitioned REPLICA IDENTITY FULL;
+ALTER TABLE public.noprivs_partitioned REPLICA IDENTITY NOTHING;
+ALTER TABLE public.noprivs_partitioned SET SCHEMA noprivs_schema;
+ALTER TABLE noprivs_schema.noprivs_partitioned SET SCHEMA public;
+ALTER TABLE public.noprivs_partM_Z ATTACH PARTITION public.noprivs_table FOR VALUES FROM ('0') TO ('9');
+ERROR:  table "noprivs_partm_z" is not partitioned
+ALTER TABLE public.noprivs_partM_Z DETACH PARTITION public.noprivs_table;
+ERROR:  table "noprivs_partm_z" is not partitioned
+ALTER TABLE public.noprivs_partM_Z DETACH PARTITION public.noprivs_partA_M;
+ERROR:  table "noprivs_partm_z" is not partitioned
+ALTER TABLE public.noprivs_partM_Z ATTACH PARTITION public.noprivs_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  table "noprivs_partm_z" is not partitioned
+ALTER TABLE public.noprivs_partM_Z INHERIT public.noprivs_table;
+ERROR:  cannot change inheritance of a partition
+ALTER TABLE public.noprivs_partM_Z NO INHERIT public.noprivs_table;
+ERROR:  cannot change inheritance of a partition
+ALTER TABLE public.noprivs_partM_Z REPLICA IDENTITY FULL;
+ALTER TABLE public.noprivs_partM_Z REPLICA IDENTITY NOTHING;
+ALTER TABLE public.noprivs_partM_Z SET SCHEMA noprivs_schema;
+ALTER TABLE noprivs_schema.noprivs_partM_Z SET SCHEMA public;
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  must be owner of table superdba_parta_m
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.superdba_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  must be owner of table superdba_parta_m
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.superdba_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ERROR:  must be owner of table superdba_partm_z
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.noprivs_partA_M FOR VALUES FROM ('A') TO ('M');
+ERROR:  "noprivs_parta_m" is already a partition
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.noprivs_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ERROR:  "noprivs_partm_z" is already a partition
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.superdba_partA_M;
+ERROR:  relation "superdba_parta_m" is not a partition of relation "noprivs_partitioned"
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.superdba_partA_M;
+ERROR:  relation "superdba_parta_m" is not a partition of relation "noprivs_partitioned"
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.noprivs_partA_M;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration OWNER TO noprivs;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration OWNER TO dba;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration SET SCHEMA noprivs_schema;
+ALTER TEXT SEARCH CONFIGURATION noprivs_schema.noprivs_tsconfiguration SET SCHEMA public;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration RENAME TO noprivs_tsconfiguration_renamed;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration_renamed RENAME TO noprivs_tsconfiguration;
+ALTER TRIGGER noprivs_trigger ON public.noprivs_table RENAME TO noprivs_trigger_renamed;
+ALTER TRIGGER noprivs_trigger_renamed ON public.noprivs_table RENAME TO noprivs_trigger;
+ALTER TRIGGER noprivs_trigger ON public.noprivs_table DEPENDS ON EXTENSION plpgsql;
+ALTER TRIGGER noprivs_trigger ON public.noprivs_table NO DEPENDS ON EXTENSION plpgsql;
+ALTER TYPE public.noprivs_type OWNER TO dba;
+ALTER TYPE public.noprivs_type OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER TYPE public.noprivs_type OWNER TO noprivs;
+ALTER TYPE public.noprivs_type RENAME TO noprivs_type_renamed;
+ALTER TYPE public.noprivs_type_renamed RENAME TO noprivs_type;
+ALTER TYPE public.noprivs_type SET SCHEMA noprivs_schema;
+ALTER TYPE noprivs_schema.noprivs_type SET SCHEMA public;
+ALTER TYPE public.noprivs_type ADD VALUE 'strange';
+ALTER TYPE public.noprivs_type RENAME VALUE 'spin' TO 'twist';
+ALTER TYPE public.noprivs_type SET ( ANALYZE = none );
+ERROR:  must be superuser to alter a type
+ALTER TYPE public.noprivs_type SET ( SUBSCRIPT = none );
+ERROR:  must be superuser to alter a type
+ALTER TYPE public.noprivs_type SET ( STORAGE = plain );
+ERROR:  noprivs_type is not a base type
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) OWNER TO dba;
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) OWNER TO noprivs;
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) SET SCHEMA noprivs_schema;
+ALTER PROCEDURE noprivs_schema.noprivs_procedure (t noprivs_type) SET SCHEMA public;
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) RENAME TO noprivs_procedure_renamed;
+ALTER PROCEDURE public.noprivs_procedure_renamed (t noprivs_type) RENAME TO noprivs_procedure;
+ALTER VIEW public.noprivs_view ALTER COLUMN str SET DEFAULT 'otherstr';
+ALTER VIEW public.noprivs_view ALTER COLUMN str DROP DEFAULT;
+ALTER VIEW public.noprivs_view OWNER TO dba;
+ALTER VIEW public.noprivs_view OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER VIEW public.noprivs_view OWNER TO noprivs;
+ALTER VIEW public.noprivs_view RENAME COLUMN ary TO ary_renamed;
+ALTER VIEW public.noprivs_view RENAME COLUMN ary_renamed TO ary;
+ALTER VIEW public.noprivs_view RENAME TO noprivs_view_renamed;
+ALTER VIEW public.noprivs_view_renamed RENAME TO noprivs_view;
+ALTER VIEW public.noprivs_view SET SCHEMA noprivs_schema;
+ALTER VIEW noprivs_schema.noprivs_view SET SCHEMA public;
+ALTER VIEW public.noprivs_view SET (check_option = local);
+ALTER VIEW public.noprivs_view SET (check_option = cascaded);
+ALTER VIEW public.noprivs_view RESET (check_option);
+ALTER VIEW public.noprivs_view SET (security_barrier = on);
+ALTER VIEW public.noprivs_view SET (security_barrier = off);
+ALTER VIEW public.noprivs_view RESET (security_barrier);
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) OWNER TO dba;
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) OWNER TO noprivs;
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) SET SCHEMA noprivs_schema;
+ALTER FUNCTION noprivs_schema.noprivs_type_eq (noprivs_type, noprivs_type) SET SCHEMA public;
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) DEPENDS ON EXTENSION plpgsql;
+ALTER OPERATOR public.=== (noprivs_type, noprivs_type) OWNER TO dba;
+ALTER OPERATOR public.=== (noprivs_type, noprivs_type) OWNER TO superdba;
+ERROR:  must be member of role "superdba"
+ALTER OPERATOR public.=== (noprivs_type, noprivs_type) OWNER TO noprivs;
+ALTER OPERATOR public.=== (noprivs_type, noprivs_type) SET SCHEMA noprivs_schema;
+ALTER OPERATOR noprivs_schema.=== (noprivs_type, noprivs_type) SET SCHEMA public;
+RESET SESSION AUTHORIZATION;
+-- Check permissions for dba who has pg_manage_database_objects membership
+SET SESSION AUTHORIZATION dba;
+-- attempt to comment on system built-in objects
+COMMENT ON ACCESS METHOD spgist IS 'comment on built-in object';
+ERROR:  must be superuser
+COMMENT ON AGGREGATE pg_catalog.avg(int8) IS 'comment on built-in object';
+ERROR:  must be owner of aggregate pg_catalog.avg
+COMMENT ON CAST (int4 AS int8) IS 'comment on built-in object';
+ERROR:  must be owner of type integer or type bigint
+COMMENT ON COLLATION "nl_NL.UTF-8" IS 'comment on built-in object';
+ERROR:  must be owner of collation nl_NL.UTF-8
+COMMENT ON CONVERSION utf8_to_windows_1251 IS 'comment on built-in object';
+ERROR:  must be owner of conversion utf8_to_windows_1251
+COMMENT ON DATABASE template1 IS 'comment on built-in object';
+ERROR:  must be owner of database template1
+COMMENT ON DOMAIN information_schema.cardinal_number IS 'comment on built-in object';
+ERROR:  must be owner of type information_schema.cardinal_number
+COMMENT ON LANGUAGE sql IS 'comment on built-in object';
+ERROR:  must be owner of language sql
+COMMENT ON TABLE pg_catalog.pg_class IS 'comment on built-in object';
+ERROR:  must be owner of table pg_class
+COMMENT ON EXTENSION plpgsql IS 'comment on built-in object';
+ERROR:  must be owner of extension plpgsql
+COMMENT ON OPERATOR CLASS float4_ops USING btree IS 'comment on built-in object';
+ERROR:  must be owner of operator class btree.float4_ops
+COMMENT ON OPERATOR FAMILY float_ops USING btree IS 'comment on built-in object';
+ERROR:  must be owner of operator family btree.float_ops
+COMMENT ON ROLE pg_read_server_files IS 'comment on built-in object';
+ERROR:  must have CREATEROLE privilege
+COMMENT ON RULE pg_settings_u ON pg_catalog.pg_settings IS 'comment on built-in object';
+ERROR:  must be owner of relation pg_settings
+COMMENT ON SCHEMA information_schema IS 'comment on built-in object';
+ERROR:  must be owner of schema information_schema
+COMMENT ON TABLE information_schema.sql_features IS 'comment on built-in object';
+ERROR:  must be owner of table sql_features
+COMMENT ON TABLESPACE pg_global IS 'comment on built-in object';
+ERROR:  must be owner of tablespace pg_global
+COMMENT ON VIEW information_schema.foreign_table_options IS 'comment on built-in object';
+ERROR:  must be owner of view foreign_table_options
+COMMENT ON FUNCTION information_schema._pg_expandarray(IN anyarray, OUT x anyelement, OUT n int) IS 'comment on built-in object';
+ERROR:  must be owner of function information_schema._pg_expandarray
+-- attempt to comment on objects owned by superdba
+COMMENT ON AGGREGATE public.superdba_aggregate(int4) IS 'comment on superdba object';
+ERROR:  must be owner of aggregate public.superdba_aggregate
+COMMENT ON CAST (numeric AS text) IS 'comment on superdba object';
+ERROR:  must be owner of type numeric or type text
+COMMENT ON CAST (text AS numeric) IS 'comment on superdba object';
+ERROR:  must be owner of type text or type numeric
+COMMENT ON COLLATION public.superdba_collation IS 'comment on superdba object';
+ERROR:  must be owner of collation public.superdba_collation
+COMMENT ON CONSTRAINT superdba_domconstraint ON DOMAIN superdba_domain IS 'comment on superdba object';
+ERROR:  must be owner of type superdba_domain
+COMMENT ON CONVERSION superdba_conversion IS 'comment on superdba object';
+ERROR:  must be owner of conversion superdba_conversion
+COMMENT ON DOMAIN superdba_domain IS 'comment on superdba object';
+ERROR:  must be owner of type superdba_domain
+COMMENT ON EVENT TRIGGER superdba_event_trigger_start IS 'comment on superdba object';
+ERROR:  must be owner of event trigger superdba_event_trigger_start
+COMMENT ON EVENT TRIGGER superdba_event_trigger_end IS 'comment on superdba object';
+ERROR:  must be owner of event trigger superdba_event_trigger_end
+COMMENT ON EVENT TRIGGER superdba_event_trigger_rewrite IS 'comment on superdba object';
+ERROR:  must be owner of event trigger superdba_event_trigger_rewrite
+COMMENT ON EVENT TRIGGER superdba_event_trigger_drop IS 'comment on superdba object';
+ERROR:  must be owner of event trigger superdba_event_trigger_drop
+COMMENT ON FUNCTION superdba_event_trigger_func() IS 'comment on superdba object';
+ERROR:  must be owner of function superdba_event_trigger_func
+COMMENT ON FUNCTION superdba_trigger_func() IS 'comment on superdba object';
+ERROR:  must be owner of function superdba_trigger_func
+COMMENT ON TABLE public.superdba_table IS 'comment on superdba object';
+ERROR:  must be owner of table superdba_table
+COMMENT ON MATERIALIZED VIEW superdba_matview IS 'comment on superdba object';
+ERROR:  must be owner of materialized view superdba_matview
+COMMENT ON POLICY superdba_policy ON superdba_table IS 'comment on superdba object';
+ERROR:  must be owner of relation superdba_table
+COMMENT ON PUBLICATION superdba_publication IS 'comment on superdba object';
+ERROR:  must be owner of publication superdba_publication
+COMMENT ON RULE superdba_rule ON superdba_table IS 'comment on superdba object';
+ERROR:  must be owner of relation superdba_table
+COMMENT ON SCHEMA superdba_schema IS 'comment on superdba object';
+ERROR:  must be owner of schema superdba_schema
+COMMENT ON SEQUENCE superdba_sequence IS 'comment on superdba object';
+ERROR:  must be owner of sequence superdba_sequence
+COMMENT ON STATISTICS superdba_statistics IS 'comment on superdba object';
+ERROR:  must be owner of statistics object superdba_statistics
+COMMENT ON SUBSCRIPTION superdba_subscription IS 'comment on superdba object';
+ERROR:  must be owner of subscription superdba_subscription
+COMMENT ON CONSTRAINT superdba_constraint ON superdba_table IS 'comment on superdba object';
+ERROR:  must be owner of relation superdba_table
+COMMENT ON TEXT SEARCH PARSER superdba_tsparser IS 'comment on superdba object';
+ERROR:  must be superuser
+COMMENT ON TEXT SEARCH TEMPLATE superdba_tstemplate IS 'comment on superdba object';
+ERROR:  must be superuser
+COMMENT ON TEXT SEARCH CONFIGURATION superdba_tsconfiguration IS 'comment on superdba object';
+ERROR:  must be owner of text search configuration superdba_tsconfiguration
+COMMENT ON TEXT SEARCH DICTIONARY superdba_tsdictionary IS 'comment on superdba object';
+ERROR:  must be owner of text search dictionary superdba_tsdictionary
+COMMENT ON TRIGGER superdba_trigger ON superdba_table IS 'comment on superdba object';
+ERROR:  must be owner of relation superdba_table
+COMMENT ON TYPE superdba_type IS 'comment on superdba object';
+ERROR:  must be owner of type superdba_type
+COMMENT ON PROCEDURE superdba_procedure (t superdba_type) IS 'comment on superdba object';
+ERROR:  must be owner of procedure superdba_procedure
+COMMENT ON VIEW superdba_view IS 'comment on superdba object';
+ERROR:  must be owner of view superdba_view
+COMMENT ON FUNCTION superdba_type_eq (superdba_type, superdba_type) IS 'comment on superdba object';
+ERROR:  must be owner of function superdba_type_eq
+COMMENT ON OPERATOR === (superdba_type, superdba_type) IS 'comment on superdba object';
+ERROR:  must be owner of operator ===
+-- attempt to comment on objects owned by privileged user "noprivs"
+COMMENT ON AGGREGATE public.noprivs_aggregate(int4) IS 'comment on noprivs object';
+COMMENT ON COLLATION public.noprivs_collation IS 'comment on noprivs object';
+COMMENT ON CONSTRAINT noprivs_domconstraint ON DOMAIN noprivs_domain IS 'comment on noprivs object';
+COMMENT ON CONVERSION noprivs_conversion IS 'comment on noprivs object';
+COMMENT ON DOMAIN noprivs_domain IS 'comment on noprivs object';
+COMMENT ON FUNCTION noprivs_event_trigger_func() IS 'comment on noprivs object';
+COMMENT ON FUNCTION noprivs_trigger_func() IS 'comment on noprivs object';
+COMMENT ON TABLE public.noprivs_table IS 'comment on noprivs object';
+COMMENT ON TEXT SEARCH CONFIGURATION noprivs_tsconfiguration IS 'comment on noprivs object';
+COMMENT ON MATERIALIZED VIEW noprivs_matview IS 'comment on noprivs object';
+COMMENT ON POLICY noprivs_policy ON noprivs_table IS 'comment on noprivs object';
+COMMENT ON RULE noprivs_rule ON noprivs_table IS 'comment on noprivs object';
+COMMENT ON SCHEMA noprivs_schema IS 'comment on noprivs object';
+COMMENT ON SEQUENCE noprivs_sequence IS 'comment on noprivs object';
+COMMENT ON STATISTICS noprivs_statistics IS 'comment on noprivs object';
+COMMENT ON CONSTRAINT noprivs_constraint ON noprivs_table IS 'comment on noprivs object';
+COMMENT ON TRIGGER noprivs_trigger ON noprivs_table IS 'comment on noprivs object';
+COMMENT ON TYPE noprivs_type IS 'comment on noprivs object';
+COMMENT ON PROCEDURE noprivs_procedure (t noprivs_type) IS 'comment on noprivs object';
+COMMENT ON VIEW noprivs_view IS 'comment on noprivs object';
+COMMENT ON FUNCTION noprivs_type_eq (noprivs_type, noprivs_type) IS 'comment on noprivs object';
+COMMENT ON OPERATOR === (noprivs_type, noprivs_type) IS 'comment on noprivs object';
+RESET SESSION AUTHORIZATION;
+-- Check permissions for dba who has pg_manage_database_objects membership
+SET SESSION AUTHORIZATION dba;
+-- attempt to drop system built-in objects
+DROP ACCESS METHOD spgist;
+ERROR:  must be superuser
+DROP AGGREGATE pg_catalog.avg(int8);
+ERROR:  must be owner of aggregate pg_catalog.avg
+DROP CAST (int4 AS int8);
+ERROR:  must be owner of type integer or type bigint
+DROP COLLATION "nl_NL.UTF-8";
+ERROR:  must be owner of collation nl_NL.UTF-8
+DROP CONVERSION utf8_to_windows_1251;
+ERROR:  must be owner of conversion utf8_to_windows_1251
+DROP DATABASE template1;
+ERROR:  must be owner of database template1
+DROP DOMAIN information_schema.cardinal_number;
+ERROR:  must be owner of type information_schema.cardinal_number
+DROP EXTENSION plpgsql;
+ERROR:  must be owner of extension plpgsql
+DROP LANGUAGE sql;
+ERROR:  must be owner of language sql
+DROP OPERATOR CLASS float4_ops USING btree;
+ERROR:  must be owner of operator class btree.float4_ops
+DROP OPERATOR FAMILY float_ops USING btree;
+ERROR:  must be owner of operator family btree.float_ops
+DROP ROLE pg_read_server_files;
+ERROR:  permission denied to drop role
+DROP RULE pg_settings_u ON pg_catalog.pg_settings;
+ERROR:  must be owner of relation pg_settings
+DROP TABLE pg_catalog.pg_class;
+ERROR:  must be owner of table pg_class
+DROP SCHEMA information_schema;
+ERROR:  must be owner of schema information_schema
+DROP TABLE information_schema.sql_features;
+ERROR:  must be owner of table sql_features
+DROP TABLESPACE pg_global;
+ERROR:  must be owner of tablespace pg_global
+DROP VIEW information_schema.foreign_table_options;
+ERROR:  must be owner of view foreign_table_options
+DROP FUNCTION information_schema._pg_expandarray(IN anyarray, OUT x anyelement, OUT n int);
+ERROR:  must be owner of function information_schema._pg_expandarray
+-- attempt to drop objects owned by superdba
+DROP AGGREGATE public.superdba_aggregate(int4);
+ERROR:  must be owner of aggregate public.superdba_aggregate
+DROP CAST (numeric AS text);
+ERROR:  must be owner of type numeric or type text
+DROP CAST (text AS numeric);
+ERROR:  must be owner of type text or type numeric
+DROP TABLE superdba_partA_M;
+ERROR:  must be owner of table superdba_parta_m
+DROP TABLE superdba_partM_Z;
+ERROR:  must be owner of table superdba_partm_z
+DROP TABLE superdba_partitioned;
+ERROR:  must be owner of table superdba_partitioned
+DROP CONVERSION superdba_conversion;
+ERROR:  must be owner of conversion superdba_conversion
+DROP DOMAIN superdba_domain;
+ERROR:  must be owner of type superdba_domain
+DROP EVENT TRIGGER superdba_event_trigger_start;
+ERROR:  must be owner of event trigger superdba_event_trigger_start
+DROP EVENT TRIGGER superdba_event_trigger_end;
+ERROR:  must be owner of event trigger superdba_event_trigger_end
+DROP EVENT TRIGGER superdba_event_trigger_rewrite;
+ERROR:  must be owner of event trigger superdba_event_trigger_rewrite
+DROP EVENT TRIGGER superdba_event_trigger_drop;
+ERROR:  must be owner of event trigger superdba_event_trigger_drop
+DROP FUNCTION superdba_event_trigger_func();
+ERROR:  must be owner of function superdba_event_trigger_func
+DROP INDEX superdba_index;
+ERROR:  must be owner of index superdba_index
+DROP MATERIALIZED VIEW superdba_matview;
+ERROR:  must be owner of materialized view superdba_matview
+DROP POLICY superdba_policy ON superdba_table;
+ERROR:  must be owner of relation superdba_table
+DROP PUBLICATION superdba_publication;
+ERROR:  must be owner of publication superdba_publication
+DROP RULE superdba_rule ON superdba_table;
+ERROR:  must be owner of relation superdba_table
+DROP SCHEMA superdba_schema;
+ERROR:  must be owner of schema superdba_schema
+DROP STATISTICS superdba_statistics;
+ERROR:  must be owner of statistics object superdba_statistics
+DROP SUBSCRIPTION superdba_subscription;
+ERROR:  must be owner of subscription superdba_subscription
+DROP VIEW superdba_view;
+ERROR:  must be owner of view superdba_view
+ALTER TABLE superdba_table DROP CONSTRAINT superdba_constraint;
+ERROR:  must be owner of table superdba_table
+DROP TABLE public.superdba_table;
+ERROR:  must be owner of table superdba_table
+DROP COLLATION public.superdba_collation;
+ERROR:  must be owner of collation public.superdba_collation
+DROP SEQUENCE superdba_sequence;
+ERROR:  must be owner of sequence superdba_sequence
+DROP TRIGGER superdba_trigger ON superdba_table;
+ERROR:  must be owner of relation superdba_table
+DROP FUNCTION superdba_trigger_func();
+ERROR:  must be owner of function superdba_trigger_func
+DROP TEXT SEARCH CONFIGURATION superdba_tsconfiguration;
+ERROR:  must be owner of text search configuration superdba_tsconfiguration
+DROP TEXT SEARCH DICTIONARY superdba_tsdictionary;
+ERROR:  must be owner of text search dictionary superdba_tsdictionary
+DROP TEXT SEARCH PARSER superdba_tsparser;
+ERROR:  must be superuser
+DROP TEXT SEARCH TEMPLATE superdba_tstemplate;
+ERROR:  must be superuser
+DROP TRANSFORM FOR bigint LANGUAGE SQL;
+ERROR:  must be owner of type bigint
+DROP OPERATOR === (superdba_type, superdba_type);
+ERROR:  must be owner of operator ===
+DROP FUNCTION superdba_type_eq (superdba_type, superdba_type);
+ERROR:  must be owner of function superdba_type_eq
+DROP PROCEDURE superdba_procedure (t superdba_type);
+ERROR:  must be owner of procedure superdba_procedure
+DROP TYPE superdba_type;
+ERROR:  must be owner of type superdba_type
+-- attempt to drop objects owned by unprivileged user "noprivs"
+DROP AGGREGATE public.noprivs_aggregate(int4);
+DROP TABLE noprivs_partA_M;
+DROP TABLE noprivs_partM_Z;
+DROP TABLE noprivs_partitioned;
+DROP CONVERSION noprivs_conversion;
+DROP DOMAIN noprivs_domain;
+DROP FUNCTION noprivs_event_trigger_func();
+DROP INDEX noprivs_index;
+DROP MATERIALIZED VIEW noprivs_matview;
+DROP POLICY noprivs_policy ON noprivs_table;
+DROP RULE noprivs_rule ON noprivs_table;
+DROP SCHEMA noprivs_schema;
+DROP STATISTICS noprivs_statistics;
+DROP VIEW noprivs_view;
+ALTER TABLE noprivs_table DROP CONSTRAINT noprivs_constraint;
+DROP TEXT SEARCH CONFIGURATION noprivs_tsconfiguration;
+DROP TEXT SEARCH DICTIONARY noprivs_tsdictionary;
+DROP TRIGGER noprivs_trigger ON noprivs_table;
+DROP TABLE public.noprivs_table;
+DROP COLLATION public.noprivs_collation;
+DROP SEQUENCE noprivs_sequence;
+DROP FUNCTION noprivs_trigger_func();
+DROP OPERATOR === (noprivs_type, noprivs_type);
+DROP FUNCTION noprivs_type_eq (noprivs_type, noprivs_type);
+DROP PROCEDURE noprivs_procedure (t noprivs_type);
+DROP TYPE noprivs_type;
+-- attempt to drop users
+DROP USER noprivs;
+ERROR:  permission denied to drop role
+DROP USER superdba;
+ERROR:  permission denied to drop role
+RESET SESSION AUTHORIZATION;
+-- drop remaining objects owned by superdba
+DROP AGGREGATE public.superdba_aggregate(int4);
+DROP CAST (numeric AS text);
+DROP CAST (text AS numeric);
+DROP TABLE superdba_partA_M;
+DROP TABLE superdba_partM_Z;
+DROP TABLE superdba_partitioned;
+DROP CONVERSION superdba_conversion;
+DROP DOMAIN superdba_domain;
+DROP EVENT TRIGGER superdba_event_trigger_start;
+DROP EVENT TRIGGER superdba_event_trigger_end;
+DROP EVENT TRIGGER superdba_event_trigger_rewrite;
+DROP EVENT TRIGGER superdba_event_trigger_drop;
+DROP FUNCTION superdba_event_trigger_func();
+DROP INDEX superdba_index;
+DROP MATERIALIZED VIEW superdba_matview;
+DROP POLICY superdba_policy ON superdba_table;
+DROP PUBLICATION superdba_publication;
+DROP RULE superdba_rule ON superdba_table;
+DROP SCHEMA superdba_schema;
+DROP STATISTICS superdba_statistics;
+DROP SUBSCRIPTION superdba_subscription;
+DROP TRIGGER superdba_trigger ON superdba_table;
+DROP FUNCTION superdba_trigger_func();
+DROP VIEW superdba_view;
+ALTER TABLE superdba_table DROP CONSTRAINT superdba_constraint;
+DROP TABLE public.superdba_table;
+DROP COLLATION public.superdba_collation;
+DROP SEQUENCE superdba_sequence;
+DROP TEXT SEARCH CONFIGURATION superdba_tsconfiguration;
+DROP TEXT SEARCH DICTIONARY superdba_tsdictionary;
+DROP TEXT SEARCH PARSER superdba_tsparser;
+DROP TEXT SEARCH TEMPLATE superdba_tstemplate;
+DROP TRANSFORM FOR bigint LANGUAGE SQL;
+DROP OPERATOR === (superdba_type, superdba_type);
+DROP FUNCTION superdba_type_eq (superdba_type, superdba_type);
+DROP PROCEDURE superdba_procedure (t superdba_type);
+DROP TYPE superdba_type;
+-- finished tests relying on these users
+DROP USER dba;
+DROP USER noprivs;
+DROP USER superdba;
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index 8fd9d215ff..b47b7dee8c 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -103,7 +103,7 @@ test: publication subscription
 # ----------
 # Another group of parallel tests
 # ----------
-test: select_views portals_p2 foreign_key cluster dependency guc bitmapops combocid tsearch tsdicts foreign_data window xmlmap functional_deps advisory_lock indirect_toast equivclass
+test: select_views portals_p2 foreign_key cluster dependency guc bitmapops combocid tsearch tsdicts foreign_data window xmlmap functional_deps advisory_lock indirect_toast equivclass role_priv
 
 # ----------
 # Another group of parallel tests (JSON related)
diff --git a/src/test/regress/sql/role_priv.sql b/src/test/regress/sql/role_priv.sql
new file mode 100644
index 0000000000..0a75a6a549
--- /dev/null
+++ b/src/test/regress/sql/role_priv.sql
@@ -0,0 +1,879 @@
+CREATE USER dba NOSUPERUSER;
+GRANT pg_manage_database_objects TO dba;
+
+CREATE USER noprivs NOSUPERUSER;
+CREATE USER superdba SUPERUSER;
+
+CREATE SCHEMA noprivs_schema;
+ALTER SCHEMA noprivs_schema OWNER TO noprivs;
+
+SET SESSION AUTHORIZATION superdba;
+CREATE AGGREGATE superdba_aggregate (
+   sfunc = int4_avg_accum,
+   basetype = int4,
+   stype = _int8,
+   finalfunc = int8_avg,
+   initcond1 = '{0,0}'
+);
+CREATE CAST (numeric AS text) WITHOUT FUNCTION;
+CREATE CAST (text AS numeric) WITH INOUT;
+CREATE COLLATION superdba_collation FROM "C";
+CREATE CONVERSION superdba_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
+CREATE DOMAIN superdba_domain numeric(8,2) CONSTRAINT superdba_domconstraint CHECK(VALUE != 42);
+CREATE FUNCTION superdba_event_trigger_func() RETURNS EVENT_TRIGGER AS $$ BEGIN RETURN; END; $$ LANGUAGE PLPGSQL;
+CREATE EVENT TRIGGER superdba_event_trigger_start ON ddl_command_start
+	WHEN TAG IN ('ALTER ACCESS METHOD')
+	EXECUTE FUNCTION superdba_event_trigger_func();
+CREATE EVENT TRIGGER superdba_event_trigger_end ON ddl_command_end
+	WHEN TAG IN ('ALTER FOREIGN TABLE')
+	EXECUTE FUNCTION superdba_event_trigger_func();
+CREATE EVENT TRIGGER superdba_event_trigger_rewrite ON table_rewrite
+	WHEN TAG IN ('ALTER TABLE')
+	EXECUTE FUNCTION superdba_event_trigger_func();
+CREATE EVENT TRIGGER superdba_event_trigger_drop ON sql_drop
+	WHEN TAG IN ('DROP INDEX')
+	EXECUTE FUNCTION superdba_event_trigger_func();
+CREATE SEQUENCE superdba_sequence;
+CREATE TABLE superdba_table (
+	id INTEGER DEFAULT nextval('superdba_sequence'),
+	id2 INTEGER GENERATED ALWAYS AS (length(str)) STORED,
+	id3 INTEGER GENERATED BY DEFAULT AS IDENTITY (NO CYCLE),
+	str TEXT,
+	ary INTEGER[],
+	adr INET,
+	CONSTRAINT superdba_constraint CHECK (length(str) < 100)
+);
+CREATE TABLE superdba_partitioned (
+	LIKE superdba_table
+) PARTITION BY RANGE (str COLLATE superdba_collation);
+CREATE TABLE superdba_partA_M PARTITION OF superdba_partitioned FOR VALUES FROM ('A') TO ('M');
+CREATE TABLE superdba_partM_Z PARTITION OF superdba_partitioned FOR VALUES FROM ('M') TO ('Z');
+CREATE INDEX superdba_index ON superdba_table (str);
+CREATE MATERIALIZED VIEW superdba_matview AS SELECT id, str, ary FROM superdba_table;
+CREATE POLICY superdba_policy ON superdba_table AS RESTRICTIVE;
+SET client_min_messages = 'ERROR';
+CREATE PUBLICATION superdba_publication FOR TABLE superdba_table;
+RESET client_min_messages;
+CREATE RULE superdba_rule AS ON UPDATE TO superdba_table DO INSTEAD NOTHING;
+CREATE SCHEMA superdba_schema;
+CREATE STATISTICS superdba_statistics ON (length(str)) FROM superdba_table;
+CREATE SUBSCRIPTION superdba_subscription CONNECTION 'dbname=none' PUBLICATION none WITH (connect = false, slot_name = NONE);
+CREATE TEXT SEARCH PARSER superdba_tsparser (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
+CREATE TEXT SEARCH TEMPLATE superdba_tstemplate (lexize=dsimple_lexize);
+CREATE TEXT SEARCH CONFIGURATION superdba_tsconfiguration (parser = superdba_tsparser);
+CREATE TEXT SEARCH DICTIONARY superdba_tsdictionary (template = superdba_tstemplate);
+CREATE TRANSFORM FOR bigint LANGUAGE SQL (
+    FROM SQL WITH FUNCTION prsd_lextype(internal),
+    TO SQL WITH FUNCTION int8recv(internal));
+CREATE FUNCTION superdba_trigger_func() RETURNS trigger AS $$ BEGIN RETURN NEW; END; $$ LANGUAGE PLPGSQL;
+CREATE TRIGGER superdba_trigger BEFORE INSERT ON superdba_table EXECUTE FUNCTION superdba_trigger_func();
+CREATE TYPE superdba_type AS ENUM ('charge', 'charm', 'color', 'mass', 'spin');
+CREATE FUNCTION superdba_type_eq (leftarg superdba_type, rightarg superdba_type) RETURNS BOOLEAN AS $$
+	SELECT $1::text = $2::text;
+$$ LANGUAGE sql;
+CREATE OPERATOR === (
+	FUNCTION = superdba_type_eq,
+	LEFTARG = superdba_type,
+	RIGHTARG = superdba_type
+);
+CREATE PROCEDURE superdba_procedure (t superdba_type) AS $$ BEGIN RETURN; END; $$ LANGUAGE PLPGSQL;
+CREATE VIEW superdba_view AS SELECT str, ary FROM superdba_table;
+RESET SESSION AUTHORIZATION;
+
+-- create objects owned by unprivileged user "noprivs"
+SET SESSION AUTHORIZATION noprivs;
+
+CREATE AGGREGATE noprivs_aggregate (
+   sfunc = int4_avg_accum,
+   basetype = int4,
+   stype = _int8,
+   finalfunc = int8_avg,
+   initcond1 = '{0,0}'
+);
+CREATE CAST (timestamp AS tsquery) WITHOUT FUNCTION;
+CREATE CAST (tsquery AS timestamp) WITH INOUT;
+CREATE COLLATION noprivs_collation FROM "C";
+CREATE CONVERSION noprivs_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
+CREATE DOMAIN noprivs_domain numeric(10,4) CONSTRAINT noprivs_domconstraint CHECK(VALUE != 42);
+CREATE FUNCTION noprivs_event_trigger_func() RETURNS EVENT_TRIGGER AS $$ BEGIN RETURN; END; $$ LANGUAGE PLPGSQL;
+CREATE EVENT TRIGGER noprivs_event_trigger_start ON ddl_command_start
+	WHEN TAG IN ('REVOKE')
+	EXECUTE FUNCTION noprivs_event_trigger_func();
+CREATE EVENT TRIGGER noprivs_event_trigger_end ON ddl_command_end
+	WHEN TAG IN ('SECURITY LABLE')
+	EXECUTE FUNCTION noprivs_event_trigger_func();
+CREATE EVENT TRIGGER noprivs_event_trigger_rewrite ON table_rewrite
+	WHEN TAG IN ('ALTER TABLE')
+	EXECUTE FUNCTION noprivs_event_trigger_func();
+CREATE EVENT TRIGGER noprivs_event_trigger_drop ON sql_drop
+	WHEN TAG IN ('DROP TRANSFORM')
+	EXECUTE FUNCTION noprivs_event_trigger_func();
+CREATE SEQUENCE noprivs_sequence;
+CREATE TABLE noprivs_table (
+	id INTEGER DEFAULT nextval('noprivs_sequence'),
+	id2 INTEGER GENERATED ALWAYS AS (length(str)) STORED,
+	id3 INTEGER GENERATED BY DEFAULT AS IDENTITY (NO CYCLE),
+	str TEXT,
+	ary INTEGER[],
+	adr INET,
+	CONSTRAINT noprivs_constraint CHECK (length(str) < 100)
+);
+CREATE TABLE noprivs_partitioned (
+	LIKE noprivs_table
+) PARTITION BY RANGE (str COLLATE noprivs_collation);
+CREATE TABLE noprivs_partA_M PARTITION OF noprivs_partitioned FOR VALUES FROM ('A') TO ('M');
+CREATE TABLE noprivs_partM_Z PARTITION OF noprivs_partitioned FOR VALUES FROM ('M') TO ('Z');
+CREATE INDEX noprivs_index ON noprivs_table (str);
+CREATE MATERIALIZED VIEW noprivs_matview AS SELECT id, str, ary FROM noprivs_table;
+CREATE POLICY noprivs_policy ON noprivs_table AS RESTRICTIVE;
+SET client_min_messages = 'ERROR';
+CREATE PUBLICATION noprivs_publication FOR TABLE noprivs_table;
+RESET client_min_messages;
+CREATE RULE noprivs_rule AS ON UPDATE TO noprivs_table DO INSTEAD NOTHING;
+CREATE SCHEMA noprivs_schema;
+CREATE STATISTICS noprivs_statistics ON (length(str)) FROM noprivs_table;
+CREATE SUBSCRIPTION noprivs_subscription CONNECTION 'dbname=none' PUBLICATION none WITH (connect = false, slot_name = NONE);
+CREATE TEXT SEARCH PARSER noprivs_tsparser (start = prsd_start, gettoken = prsd_nexttoken, end = prsd_end, lextypes = prsd_lextype);
+CREATE TEXT SEARCH TEMPLATE noprivs_tstemplate (lexize=dsimple_lexize);
+CREATE TEXT SEARCH CONFIGURATION noprivs_tsconfiguration (parser = superdba_tsparser);
+CREATE TEXT SEARCH DICTIONARY noprivs_tsdictionary (template = superdba_tstemplate);
+CREATE TRANSFORM FOR int2 LANGUAGE SQL (
+    FROM SQL WITH FUNCTION prsd_lextype(internal),
+    TO SQL WITH FUNCTION int8recv(internal));
+CREATE FUNCTION noprivs_trigger_func() RETURNS trigger AS $$ BEGIN RETURN NEW; END; $$ LANGUAGE PLPGSQL;
+CREATE TRIGGER noprivs_trigger BEFORE INSERT ON noprivs_table EXECUTE FUNCTION noprivs_trigger_func();
+CREATE TYPE noprivs_type AS ENUM ('charge', 'charm', 'color', 'mass', 'spin');
+CREATE FUNCTION noprivs_type_eq (leftarg noprivs_type, rightarg noprivs_type) RETURNS BOOLEAN AS $$
+	SELECT $1::text = $2::text;
+$$ LANGUAGE sql;
+CREATE OPERATOR === (
+	FUNCTION = noprivs_type_eq,
+	LEFTARG = noprivs_type,
+	RIGHTARG = noprivs_type
+);
+CREATE PROCEDURE noprivs_procedure (t noprivs_type) AS $$ BEGIN RETURN; END; $$ LANGUAGE PLPGSQL;
+CREATE VIEW noprivs_view AS SELECT str, ary FROM noprivs_table;
+
+RESET SESSION AUTHORIZATION;
+-- Check permissions for dba who has pg_manage_database_objects membership
+SET SESSION AUTHORIZATION dba;
+
+-- attempt to alter system built-in objects
+ALTER AGGREGATE pg_catalog.avg(int8) RENAME TO avg_renamed;
+ALTER AGGREGATE pg_catalog.avg(int8) OWNER TO noprivs;
+ALTER AGGREGATE pg_catalog.avg(int8) OWNER TO dba;
+ALTER AGGREGATE pg_catalog.avg(int8) OWNER TO superdba;
+ALTER AGGREGATE pg_catalog.avg(int8) SET SCHEMA noprivs_schema;
+
+ALTER TABLE pg_catalog.pg_class RENAME COLUMN relname TO relname_renamed;
+ALTER TABLE pg_catalog.pg_class ADD COLUMN othercolumn TEXT;
+ALTER TABLE pg_catalog.pg_class DROP COLUMN reloptions;
+ALTER TABLE pg_catalog.pg_class ALTER COLUMN relpartbound SET STATISTICS 200;
+ALTER TABLE pg_catalog.pg_class ALTER COLUMN relpartbound SET COMPRESSION pglz;
+
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 RENAME TO utf8_to_iso_8859_1_renamed;
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 OWNER TO noprivs;
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 OWNER TO dba;
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 OWNER TO superdba;
+ALTER CONVERSION pg_catalog.utf8_to_iso_8859_1 SET SCHEMA noprivs_schema;
+
+ALTER DOMAIN information_schema.cardinal_number SET DEFAULT 0;
+ALTER DOMAIN information_schema.cardinal_number SET NOT NULL;
+ALTER DOMAIN information_schema.cardinal_number ADD CHECK (VALUE >= 0);
+ALTER DOMAIN information_schema.cardinal_number RENAME TO cardinal_number_renamed;
+ALTER DOMAIN information_schema.cardinal_number OWNER TO noprivs;
+ALTER DOMAIN information_schema.cardinal_number OWNER TO dba;
+ALTER DOMAIN information_schema.cardinal_number OWNER TO superdba;
+ALTER DOMAIN information_schema.cardinal_number SET SCHEMA noprivs_schema;
+
+ALTER EXTENSION plpgsql UPDATE TO 'bogus_plpgsql_version';
+ALTER EXTENSION plpgsql SET SCHEMA noprivs_schema;
+ALTER EXTENSION plpgsql ADD TABLE pg_catalog.pg_class;
+ALTER EXTENSION plpgsql DROP TABLE pg_catalog.pg_class;
+
+ALTER RULE pg_settings_u ON pg_catalog.pg_settings RENAME TO pg_settings_u_renamed;
+ALTER RULE pg_settings_u_renamed ON pg_catalog.pg_settings RENAME TO pg_settings_u;
+
+ALTER SCHEMA information_schema OWNER TO noprivs;
+ALTER SCHEMA information_schema OWNER TO dba;
+ALTER SCHEMA information_schema OWNER TO superdba;
+ALTER SCHEMA information_schema RENAME TO information_schema_renamed;
+
+ALTER TABLE information_schema.sql_features RENAME TO sql_features_renamed;
+ALTER TABLE information_schema.sql_features OWNER TO noprivs;
+ALTER TABLE information_schema.sql_features OWNER TO dba;
+ALTER TABLE information_schema.sql_features OWNER TO superdba;
+ALTER TABLE information_schema.sql_features DISABLE ROW LEVEL SECURITY;
+ALTER TABLE information_schema.sql_features ENABLE ROW LEVEL SECURITY;
+ALTER TABLE information_schema.sql_features FORCE ROW LEVEL SECURITY;
+ALTER TABLE information_schema.sql_features NO FORCE ROW LEVEL SECURITY;
+ALTER TABLE information_schema.sql_features CLUSTER ON superdba_index;
+ALTER TABLE information_schema.sql_features SET WITHOUT CLUSTER;
+ALTER TABLE information_schema.sql_features SET WITHOUT OIDS;
+ALTER TABLE information_schema.sql_features SET SCHEMA noprivs_schema;
+
+ALTER VIEW information_schema.foreign_table_options ALTER COLUMN foreign_table_name SET DEFAULT 'something';
+ALTER VIEW information_schema.foreign_table_options ALTER COLUMN foreign_table_name DROP DEFAULT;
+ALTER VIEW information_schema.foreign_table_options OWNER TO noprivs;
+ALTER VIEW information_schema.foreign_table_options OWNER TO dba;
+ALTER VIEW information_schema.foreign_table_options OWNER TO superdba;
+ALTER VIEW information_schema.foreign_table_options RENAME COLUMN foreign_table_name TO foreign_table_name_renamed;
+ALTER VIEW information_schema.foreign_table_options RENAME COLUMN foreign_table_name_renamed TO foreign_table_name;
+ALTER VIEW information_schema.foreign_table_options RENAME TO foreign_table_options_renamed;
+ALTER VIEW information_schema.foreign_table_options SET SCHEMA noprivs_schema;
+ALTER VIEW information_schema.foreign_table_options SET (check_option = local);
+ALTER VIEW information_schema.foreign_table_options SET (check_option = cascaded);
+ALTER VIEW information_schema.foreign_table_options RESET (check_option);
+ALTER VIEW information_schema.foreign_table_options SET (security_barrier = on);
+ALTER VIEW information_schema.foreign_table_options SET (security_barrier = off);
+ALTER VIEW information_schema.foreign_table_options RESET (security_barrier);
+
+-- attempt to alter objects owned by superdba
+ALTER AGGREGATE public.superdba_aggregate(int4) RENAME TO superdba_aggregate_renamed;
+ALTER AGGREGATE public.superdba_aggregate(int4) OWNER TO noprivs;
+ALTER AGGREGATE public.superdba_aggregate(int4) OWNER TO dba;
+ALTER AGGREGATE public.superdba_aggregate(int4) OWNER TO superdba;
+ALTER AGGREGATE public.superdba_aggregate(int4) SET SCHEMA noprivs_schema;
+
+ALTER COLLATION public.superdba_collation RENAME TO superdba_collation_renamed;
+ALTER COLLATION public.superdba_collation OWNER TO noprivs;
+ALTER COLLATION public.superdba_collation OWNER TO dba;
+ALTER COLLATION public.superdba_collation OWNER TO superdba;
+ALTER COLLATION public.superdba_collation SET SCHEMA noprivs_schema;
+
+ALTER CONVERSION public.superdba_conversion RENAME TO superdba_conversion_renamed;
+ALTER CONVERSION public.superdba_conversion OWNER TO noprivs;
+ALTER CONVERSION public.superdba_conversion OWNER TO dba;
+ALTER CONVERSION public.superdba_conversion OWNER TO superdba;
+ALTER CONVERSION public.superdba_conversion SET SCHEMA noprivs_schema;
+
+ALTER DOMAIN public.superdba_domain SET DEFAULT 0;
+ALTER DOMAIN public.superdba_domain SET NOT NULL;
+ALTER DOMAIN public.superdba_domain ADD CHECK (VALUE >= 0);
+ALTER DOMAIN public.superdba_domain RENAME TO superdba_domain_renamed;
+ALTER DOMAIN public.superdba_domain OWNER TO noprivs;
+ALTER DOMAIN public.superdba_domain OWNER TO dba;
+ALTER DOMAIN public.superdba_domain OWNER TO superdba;
+ALTER DOMAIN public.superdba_domain SET SCHEMA noprivs_schema;
+ALTER DOMAIN public.superdba_domain RENAME CONSTRAINT superdba_domconstraint TO superdba_domconstraint_renamed;
+ALTER DOMAIN public.superdba_domain ADD CONSTRAINT otherconstraint CHECK (VALUE != 5);
+ALTER DOMAIN public.superdba_domain DROP CONSTRAINT otherconstraint;
+
+ALTER EVENT TRIGGER superdba_event_trigger_start DISABLE;
+ALTER EVENT TRIGGER superdba_event_trigger_start ENABLE;
+ALTER EVENT TRIGGER superdba_event_trigger_end ENABLE REPLICA;
+ALTER EVENT TRIGGER superdba_event_trigger_end ENABLE ALWAYS;
+ALTER EVENT TRIGGER superdba_event_trigger_rewrite OWNER TO noprivs;
+ALTER EVENT TRIGGER superdba_event_trigger_rewrite OWNER TO dba;
+ALTER EVENT TRIGGER superdba_event_trigger_rewrite OWNER TO superdba;
+ALTER EVENT TRIGGER superdba_event_trigger_drop RENAME TO superdba_event_trigger_drop_renamed;
+
+ALTER MATERIALIZED VIEW public.superdba_matview SET SCHEMA noprivs_schema;
+ALTER MATERIALIZED VIEW public.superdba_matview RENAME TO superdba_matview_renamed;
+ALTER MATERIALIZED VIEW public.superdba_matview RENAME ary TO ary_renamed;
+ALTER MATERIALIZED VIEW public.superdba_matview ALTER str SET STATISTICS 20;
+ALTER MATERIALIZED VIEW public.superdba_matview ALTER str SET STORAGE external;
+ALTER MATERIALIZED VIEW public.superdba_matview ALTER str SET COMPRESSION pglz;
+ALTER MATERIALIZED VIEW public.superdba_matview SET WITHOUT CLUSTER;
+ALTER MATERIALIZED VIEW public.superdba_matview OWNER TO noprivs;
+ALTER MATERIALIZED VIEW public.superdba_matview OWNER TO dba;
+ALTER MATERIALIZED VIEW public.superdba_matview OWNER TO superdba;
+
+ALTER POLICY superdba_policy ON public.superdba_table RENAME TO superdba_policy_renamed;
+
+ALTER PUBLICATION superdba_publication DROP TABLE superdba_table;
+ALTER PUBLICATION superdba_publication SET (publish = insert);
+ALTER PUBLICATION superdba_publication OWNER TO noprivs;
+ALTER PUBLICATION superdba_publication OWNER TO dba;
+ALTER PUBLICATION superdba_publication OWNER TO superdba;
+ALTER PUBLICATION superdba_publication RENAME TO superdba_publication_renamed;
+
+ALTER RULE superdba_rule ON public.superdba_table RENAME TO superdba_rule_renamed;
+
+ALTER SCHEMA superdba_schema OWNER TO noprivs;
+ALTER SCHEMA superdba_schema OWNER TO dba;
+ALTER SCHEMA superdba_schema OWNER TO superdba;
+ALTER SCHEMA superdba_schema RENAME TO superdba_schema_renamed;
+
+ALTER SEQUENCE public.superdba_sequence RESTART;
+ALTER SEQUENCE public.superdba_sequence INCREMENT BY 3;
+ALTER SEQUENCE public.superdba_sequence OWNER TO noprivs;
+ALTER SEQUENCE public.superdba_sequence OWNER TO dba;
+ALTER SEQUENCE public.superdba_sequence OWNER TO superdba;
+ALTER SEQUENCE public.superdba_sequence SET SCHEMA noprivs_schema;
+ALTER SEQUENCE public.superdba_sequence RENAME TO superdba_sequence_renamed;
+
+ALTER STATISTICS public.superdba_statistics SET STATISTICS 10000;
+ALTER STATISTICS public.superdba_statistics OWNER TO noprivs;
+ALTER STATISTICS public.superdba_statistics OWNER TO dba;
+ALTER STATISTICS public.superdba_statistics OWNER TO superdba;
+ALTER STATISTICS public.superdba_statistics RENAME TO superdba_statistics_renamed;
+ALTER STATISTICS public.superdba_statistics SET SCHEMA noprivs_schema;
+
+ALTER SUBSCRIPTION superdba_subscription CONNECTION 'dbname=other';
+ALTER SUBSCRIPTION superdba_subscription SET PUBLICATION otherpub;
+ALTER SUBSCRIPTION superdba_subscription ADD PUBLICATION anotherpub;
+ALTER SUBSCRIPTION superdba_subscription DROP PUBLICATION andere;
+ALTER SUBSCRIPTION superdba_subscription DISABLE;
+ALTER SUBSCRIPTION superdba_subscription SET (slot_name = otherslot);
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = remote_apply);
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = on);
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = remote_write);
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = local);
+ALTER SUBSCRIPTION superdba_subscription SET (synchronous_commit = off);
+ALTER SUBSCRIPTION superdba_subscription SET (binary = on);
+ALTER SUBSCRIPTION superdba_subscription SET (binary = off);
+ALTER SUBSCRIPTION superdba_subscription SET (streaming = on);
+ALTER SUBSCRIPTION superdba_subscription SET (streaming = off);
+ALTER SUBSCRIPTION superdba_subscription OWNER TO noprivs;
+ALTER SUBSCRIPTION superdba_subscription OWNER TO dba;
+ALTER SUBSCRIPTION superdba_subscription OWNER TO superdba;
+ALTER SUBSCRIPTION superdba_subscription RENAME TO superdba_subscription_renamed;
+
+ALTER TABLE public.superdba_table RENAME COLUMN str TO str_renamed;
+ALTER TABLE public.superdba_table ADD COLUMN othercolumn TEXT;
+ALTER TABLE public.superdba_table DROP COLUMN othercolumn;
+ALTER TABLE public.superdba_table DROP COLUMN adr;
+ALTER TABLE public.superdba_table ADD COLUMN adr INET;
+ALTER TABLE public.superdba_table ALTER COLUMN ary SET STATISTICS 200;
+ALTER TABLE public.superdba_table ALTER COLUMN ary SET COMPRESSION pglz;
+ALTER TABLE public.superdba_table VALIDATE CONSTRAINT superdba_constraint;
+ALTER TABLE public.superdba_table DISABLE ROW LEVEL SECURITY;
+ALTER TABLE public.superdba_table ENABLE ROW LEVEL SECURITY;
+ALTER TABLE public.superdba_table FORCE ROW LEVEL SECURITY;
+ALTER TABLE public.superdba_table NO FORCE ROW LEVEL SECURITY;
+ALTER TABLE public.superdba_table CLUSTER ON superdba_index;
+ALTER TABLE public.superdba_table SET WITHOUT CLUSTER;
+ALTER TABLE public.superdba_table SET WITHOUT OIDS;
+ALTER TABLE public.superdba_table RENAME TO superdba_table_renamed;
+ALTER TABLE public.superdba_table OWNER TO noprivs;
+ALTER TABLE public.superdba_table OWNER TO dba;
+ALTER TABLE public.superdba_table OWNER TO superdba;
+ALTER TABLE public.superdba_table SET SCHEMA noprivs_schema;
+ALTER TABLE public.superdba_table SET TABLESPACE pg_global;
+
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION pg_catalog.pg_class FOR VALUES FROM ('0') TO ('9');
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_table FOR VALUES FROM ('0') TO ('9');
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.superdba_table;
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.superdba_partA_M;
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.superdba_partitioned INHERIT public.superdba_table;
+ALTER TABLE public.superdba_partitioned NO INHERIT public.superdba_table;
+ALTER TABLE public.superdba_partitioned REPLICA IDENTITY FULL;
+ALTER TABLE public.superdba_partitioned REPLICA IDENTITY NOTHING;
+
+ALTER TABLE public.superdba_partM_Z ATTACH PARTITION public.superdba_table FOR VALUES FROM ('0') TO ('9');
+ALTER TABLE public.superdba_partM_Z DETACH PARTITION public.superdba_table;
+ALTER TABLE public.superdba_partM_Z DETACH PARTITION public.superdba_partA_M;
+ALTER TABLE public.superdba_partM_Z ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.superdba_partM_Z INHERIT public.superdba_table;
+ALTER TABLE public.superdba_partM_Z NO INHERIT public.superdba_table;
+ALTER TABLE public.superdba_partM_Z REPLICA IDENTITY FULL;
+ALTER TABLE public.superdba_partM_Z REPLICA IDENTITY NOTHING;
+
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.superdba_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.noprivs_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.superdba_partitioned ATTACH PARTITION public.noprivs_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.superdba_partA_M;
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.superdba_partA_M;
+ALTER TABLE public.superdba_partitioned DETACH PARTITION public.noprivs_partA_M;
+
+ALTER TEXT SEARCH PARSER public.superdba_tsparser SET SCHEMA noprivs_schema;
+ALTER TEXT SEARCH PARSER public.superdba_tsparser RENAME TO superdba_tsparser_renamed;
+
+ALTER TEXT SEARCH TEMPLATE public.superdba_tstemplate SET SCHEMA noprivs_schema;
+ALTER TEXT SEARCH TEMPLATE public.superdba_tstemplate RENAME TO superdba_tstemplate_renamed;
+
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration OWNER TO noprivs;
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration OWNER TO dba;
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration OWNER TO superdba;
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration SET SCHEMA noprivs_schema;
+ALTER TEXT SEARCH CONFIGURATION public.superdba_tsconfiguration RENAME TO superdba_tsconfiguration_renamed;
+
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary OWNER TO noprivs;
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary OWNER TO dba;
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary OWNER TO superdba;
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary SET SCHEMA noprivs_schema;
+ALTER TEXT SEARCH DICTIONARY public.superdba_tsdictionary RENAME TO superdba_tsdictionary_renamed;
+
+ALTER TRIGGER superdba_trigger ON public.superdba_table RENAME TO superdba_trigger_renamed;
+ALTER TRIGGER superdba_trigger ON public.superdba_table DEPENDS ON EXTENSION plpgsql;
+ALTER TRIGGER superdba_trigger ON public.superdba_table NO DEPENDS ON EXTENSION plpgsql;
+
+ALTER TYPE public.superdba_type OWNER TO noprivs;
+ALTER TYPE public.superdba_type OWNER TO dba;
+ALTER TYPE public.superdba_type OWNER TO superdba;
+ALTER TYPE public.superdba_type RENAME TO superdba_type_renamed;
+ALTER TYPE public.superdba_type SET SCHEMA noprivs_schema;
+ALTER TYPE public.superdba_type ADD VALUE 'strange';
+ALTER TYPE public.superdba_type RENAME VALUE 'spin' TO 'twist';
+ALTER TYPE public.superdba_type SET ( ANALYZE = none );
+ALTER TYPE public.superdba_type SET ( SUBSCRIPT = none );
+ALTER TYPE public.superdba_type SET ( STORAGE = plain );
+
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) OWNER TO noprivs;
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) OWNER TO dba;
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) OWNER TO superdba;
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) SET SCHEMA noprivs_schema;
+ALTER PROCEDURE public.superdba_procedure (t superdba_type) RENAME TO superdba_procedure_renamed;
+
+ALTER VIEW public.superdba_view ALTER COLUMN str SET DEFAULT 'otherstr';
+ALTER VIEW public.superdba_view ALTER COLUMN str DROP DEFAULT;
+ALTER VIEW public.superdba_view OWNER TO noprivs;
+ALTER VIEW public.superdba_view OWNER TO dba;
+ALTER VIEW public.superdba_view OWNER TO superdba;
+ALTER VIEW public.superdba_view RENAME COLUMN ary TO ary_renamed;
+ALTER VIEW public.superdba_view RENAME TO superdba_view_renamed;
+ALTER VIEW public.superdba_view SET SCHEMA noprivs_schema;
+ALTER VIEW public.superdba_view SET (check_option = local);
+ALTER VIEW public.superdba_view SET (check_option = cascaded);
+ALTER VIEW public.superdba_view RESET (check_option);
+ALTER VIEW public.superdba_view SET (security_barrier = on);
+ALTER VIEW public.superdba_view SET (security_barrier = off);
+ALTER VIEW public.superdba_view RESET (security_barrier);
+
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) OWNER TO noprivs;
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) OWNER TO dba;
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) OWNER TO superdba;
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) SET SCHEMA noprivs_schema;
+ALTER FUNCTION public.superdba_type_eq (superdba_type, superdba_type) DEPENDS ON EXTENSION plpgsql;
+
+ALTER OPERATOR public.=== (superdba_type, superdba_type) OWNER TO noprivs;
+ALTER OPERATOR public.=== (superdba_type, superdba_type) OWNER TO dba;
+ALTER OPERATOR public.=== (superdba_type, superdba_type) OWNER TO superdba;
+ALTER OPERATOR public.=== (superdba_type, superdba_type) SET SCHEMA noprivs_schema;
+
+-- attempt to alter objects owned by unprivileged user "noprivs"
+ALTER AGGREGATE public.noprivs_aggregate(int4) RENAME TO noprivs_aggregate_renamed;
+ALTER AGGREGATE public.noprivs_aggregate_renamed(int4) RENAME TO noprivs_aggregate;
+ALTER AGGREGATE public.noprivs_aggregate(int4) OWNER TO noprivs;
+ALTER AGGREGATE public.noprivs_aggregate(int4) OWNER TO dba;
+ALTER AGGREGATE public.noprivs_aggregate(int4) OWNER TO superdba;
+ALTER AGGREGATE public.noprivs_aggregate(int4) SET SCHEMA noprivs_schema;
+ALTER AGGREGATE noprivs_schema.noprivs_aggregate(int4) SET SCHEMA public;
+
+ALTER COLLATION public.noprivs_collation RENAME TO noprivs_collation_renamed;
+ALTER COLLATION public.noprivs_collation_renamed RENAME TO noprivs_collation;
+ALTER COLLATION public.noprivs_collation OWNER TO dba;
+ALTER COLLATION public.noprivs_collation OWNER TO superdba;
+ALTER COLLATION public.noprivs_collation OWNER TO noprivs;
+ALTER COLLATION public.noprivs_collation SET SCHEMA noprivs_schema;
+ALTER COLLATION noprivs_schema.noprivs_collation SET SCHEMA public;
+
+ALTER CONVERSION public.noprivs_conversion RENAME TO noprivs_conversion_renamed;
+ALTER CONVERSION public.noprivs_conversion_renamed RENAME TO noprivs_conversion;
+ALTER CONVERSION public.noprivs_conversion OWNER TO dba;
+ALTER CONVERSION public.noprivs_conversion OWNER TO superdba;
+ALTER CONVERSION public.noprivs_conversion OWNER TO noprivs;
+ALTER CONVERSION public.noprivs_conversion SET SCHEMA noprivs_schema;
+ALTER CONVERSION noprivs_schema.noprivs_conversion SET SCHEMA public;
+
+ALTER DOMAIN public.noprivs_domain SET DEFAULT 0;
+ALTER DOMAIN public.noprivs_domain SET NOT NULL;
+ALTER DOMAIN public.noprivs_domain ADD CHECK (VALUE >= 0);
+ALTER DOMAIN public.noprivs_domain RENAME TO noprivs_domain_renamed;
+ALTER DOMAIN public.noprivs_domain_renamed RENAME TO noprivs_domain;
+ALTER DOMAIN public.noprivs_domain OWNER TO dba;
+ALTER DOMAIN public.noprivs_domain OWNER TO superdba;
+ALTER DOMAIN public.noprivs_domain OWNER TO noprivs;
+ALTER DOMAIN public.noprivs_domain SET SCHEMA noprivs_schema;
+ALTER DOMAIN noprivs_schema.noprivs_domain SET SCHEMA public;
+ALTER DOMAIN public.noprivs_domain RENAME CONSTRAINT noprivs_domconstraint TO noprivs_domconstraint_renamed;
+ALTER DOMAIN public.noprivs_domain RENAME CONSTRAINT noprivs_domconstraint_renamed TO noprivs_domconstraint;
+ALTER DOMAIN public.noprivs_domain ADD CONSTRAINT otherconstraint CHECK (VALUE != 5);
+ALTER DOMAIN public.noprivs_domain DROP CONSTRAINT otherconstraint;
+
+ALTER MATERIALIZED VIEW public.noprivs_matview SET SCHEMA noprivs_schema;
+ALTER MATERIALIZED VIEW noprivs_schema.noprivs_matview SET SCHEMA public;
+ALTER MATERIALIZED VIEW public.noprivs_matview RENAME TO noprivs_matview_renamed;
+ALTER MATERIALIZED VIEW public.noprivs_matview_renamed RENAME TO noprivs_matview;
+ALTER MATERIALIZED VIEW public.noprivs_matview RENAME ary TO ary_renamed;
+ALTER MATERIALIZED VIEW public.noprivs_matview RENAME ary_renamed TO ary;
+ALTER MATERIALIZED VIEW public.noprivs_matview ALTER str SET STATISTICS 20;
+ALTER MATERIALIZED VIEW public.noprivs_matview ALTER str SET STORAGE external;
+ALTER MATERIALIZED VIEW public.noprivs_matview ALTER str SET COMPRESSION pglz;
+ALTER MATERIALIZED VIEW public.noprivs_matview SET WITHOUT CLUSTER;
+ALTER MATERIALIZED VIEW public.noprivs_matview OWNER TO dba;
+ALTER MATERIALIZED VIEW public.noprivs_matview OWNER TO superdba;
+ALTER MATERIALIZED VIEW public.noprivs_matview OWNER TO noprivs;
+
+ALTER POLICY noprivs_policy ON noprivs_table RENAME TO noprivs_policy_renamed;
+ALTER POLICY noprivs_policy_renamed ON noprivs_table RENAME TO noprivs_policy;
+
+ALTER RULE noprivs_rule ON public.noprivs_table RENAME TO noprivs_rule_renamed;
+ALTER RULE noprivs_rule_renamed ON public.noprivs_table RENAME TO noprivs_rule;
+
+ALTER SCHEMA noprivs_schema OWNER TO dba;
+ALTER SCHEMA noprivs_schema OWNER TO superdba;
+ALTER SCHEMA noprivs_schema OWNER TO noprivs;
+ALTER SCHEMA noprivs_schema RENAME TO noprivs_schema_renamed;
+ALTER SCHEMA noprivs_schema_renamed RENAME TO noprivs_schema;
+
+ALTER SEQUENCE public.noprivs_sequence RESTART;
+ALTER SEQUENCE public.noprivs_sequence INCREMENT BY 3;
+ALTER SEQUENCE public.noprivs_sequence OWNER TO dba;
+ALTER SEQUENCE public.noprivs_sequence OWNER TO superdba;
+ALTER SEQUENCE public.noprivs_sequence OWNER TO noprivs;
+ALTER SEQUENCE public.noprivs_sequence SET SCHEMA noprivs_schema;
+ALTER SEQUENCE noprivs_schema.noprivs_sequence SET SCHEMA public;;
+ALTER SEQUENCE public.noprivs_sequence RENAME TO noprivs_sequence_renamed;
+ALTER SEQUENCE public.noprivs_sequence_renamed RENAME TO noprivs_sequence;
+
+ALTER STATISTICS public.noprivs_statistics SET STATISTICS 10000;
+ALTER STATISTICS public.noprivs_statistics OWNER TO dba;
+ALTER STATISTICS public.noprivs_statistics OWNER TO superdba;
+ALTER STATISTICS public.noprivs_statistics OWNER TO noprivs;
+ALTER STATISTICS public.noprivs_statistics RENAME TO noprivs_statistics_renamed;
+ALTER STATISTICS public.noprivs_statistics_renamed RENAME TO noprivs_statistics;
+ALTER STATISTICS public.noprivs_statistics SET SCHEMA noprivs_schema;
+ALTER STATISTICS noprivs_schema.noprivs_statistics SET SCHEMA public;
+
+ALTER TABLE public.noprivs_table RENAME COLUMN str TO str_renamed;
+ALTER TABLE public.noprivs_table RENAME COLUMN str_renamed TO str;
+ALTER TABLE public.noprivs_table ADD COLUMN othercolumn TEXT;
+ALTER TABLE public.noprivs_table DROP COLUMN othercolumn;
+ALTER TABLE public.noprivs_table DROP COLUMN adr;
+ALTER TABLE public.noprivs_table ADD COLUMN adr INET;
+ALTER TABLE public.noprivs_table ALTER COLUMN ary SET STATISTICS 200;
+ALTER TABLE public.noprivs_table ALTER COLUMN ary SET COMPRESSION pglz;
+ALTER TABLE public.noprivs_table VALIDATE CONSTRAINT noprivs_constraint;
+ALTER TABLE public.noprivs_table DISABLE ROW LEVEL SECURITY;
+ALTER TABLE public.noprivs_table ENABLE ROW LEVEL SECURITY;
+ALTER TABLE public.noprivs_table FORCE ROW LEVEL SECURITY;
+ALTER TABLE public.noprivs_table NO FORCE ROW LEVEL SECURITY;
+ALTER TABLE public.noprivs_table CLUSTER ON noprivs_index;
+ALTER TABLE public.noprivs_table SET WITHOUT CLUSTER;
+ALTER TABLE public.noprivs_table SET WITHOUT OIDS;
+ALTER TABLE public.noprivs_table RENAME TO noprivs_table_renamed;
+ALTER TABLE public.noprivs_table_renamed RENAME TO noprivs_table;
+ALTER TABLE public.noprivs_table OWNER TO dba;
+ALTER TABLE public.noprivs_table OWNER TO superdba;
+ALTER TABLE public.noprivs_table OWNER TO noprivs;
+ALTER TABLE public.noprivs_table SET SCHEMA noprivs_schema;
+ALTER TABLE noprivs_schema.noprivs_table SET SCHEMA public;
+
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION pg_catalog.pg_class FOR VALUES FROM ('0') TO ('9');
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.noprivs_table FOR VALUES FROM ('0') TO ('9');
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.noprivs_table;
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.noprivs_partA_M;
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.noprivs_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.noprivs_partitioned INHERIT public.noprivs_table;
+ALTER TABLE public.noprivs_partitioned NO INHERIT public.noprivs_table;
+ALTER TABLE public.noprivs_partitioned REPLICA IDENTITY FULL;
+ALTER TABLE public.noprivs_partitioned REPLICA IDENTITY NOTHING;
+ALTER TABLE public.noprivs_partitioned SET SCHEMA noprivs_schema;
+ALTER TABLE noprivs_schema.noprivs_partitioned SET SCHEMA public;
+
+ALTER TABLE public.noprivs_partM_Z ATTACH PARTITION public.noprivs_table FOR VALUES FROM ('0') TO ('9');
+ALTER TABLE public.noprivs_partM_Z DETACH PARTITION public.noprivs_table;
+ALTER TABLE public.noprivs_partM_Z DETACH PARTITION public.noprivs_partA_M;
+ALTER TABLE public.noprivs_partM_Z ATTACH PARTITION public.noprivs_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.noprivs_partM_Z INHERIT public.noprivs_table;
+ALTER TABLE public.noprivs_partM_Z NO INHERIT public.noprivs_table;
+ALTER TABLE public.noprivs_partM_Z REPLICA IDENTITY FULL;
+ALTER TABLE public.noprivs_partM_Z REPLICA IDENTITY NOTHING;
+ALTER TABLE public.noprivs_partM_Z SET SCHEMA noprivs_schema;
+ALTER TABLE noprivs_schema.noprivs_partM_Z SET SCHEMA public;
+
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.superdba_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.superdba_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.superdba_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.noprivs_partA_M FOR VALUES FROM ('A') TO ('M');
+ALTER TABLE public.noprivs_partitioned ATTACH PARTITION public.noprivs_partM_Z FOR VALUES FROM ('M') TO ('Z');
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.superdba_partA_M;
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.superdba_partA_M;
+ALTER TABLE public.noprivs_partitioned DETACH PARTITION public.noprivs_partA_M;
+
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration OWNER TO noprivs;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration OWNER TO dba;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration OWNER TO superdba;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration SET SCHEMA noprivs_schema;
+ALTER TEXT SEARCH CONFIGURATION noprivs_schema.noprivs_tsconfiguration SET SCHEMA public;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration RENAME TO noprivs_tsconfiguration_renamed;
+ALTER TEXT SEARCH CONFIGURATION public.noprivs_tsconfiguration_renamed RENAME TO noprivs_tsconfiguration;
+
+ALTER TRIGGER noprivs_trigger ON public.noprivs_table RENAME TO noprivs_trigger_renamed;
+ALTER TRIGGER noprivs_trigger_renamed ON public.noprivs_table RENAME TO noprivs_trigger;
+ALTER TRIGGER noprivs_trigger ON public.noprivs_table DEPENDS ON EXTENSION plpgsql;
+ALTER TRIGGER noprivs_trigger ON public.noprivs_table NO DEPENDS ON EXTENSION plpgsql;
+
+ALTER TYPE public.noprivs_type OWNER TO dba;
+ALTER TYPE public.noprivs_type OWNER TO superdba;
+ALTER TYPE public.noprivs_type OWNER TO noprivs;
+ALTER TYPE public.noprivs_type RENAME TO noprivs_type_renamed;
+ALTER TYPE public.noprivs_type_renamed RENAME TO noprivs_type;
+ALTER TYPE public.noprivs_type SET SCHEMA noprivs_schema;
+ALTER TYPE noprivs_schema.noprivs_type SET SCHEMA public;
+ALTER TYPE public.noprivs_type ADD VALUE 'strange';
+ALTER TYPE public.noprivs_type RENAME VALUE 'spin' TO 'twist';
+ALTER TYPE public.noprivs_type SET ( ANALYZE = none );
+ALTER TYPE public.noprivs_type SET ( SUBSCRIPT = none );
+ALTER TYPE public.noprivs_type SET ( STORAGE = plain );
+
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) OWNER TO dba;
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) OWNER TO superdba;
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) OWNER TO noprivs;
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) SET SCHEMA noprivs_schema;
+ALTER PROCEDURE noprivs_schema.noprivs_procedure (t noprivs_type) SET SCHEMA public;
+ALTER PROCEDURE public.noprivs_procedure (t noprivs_type) RENAME TO noprivs_procedure_renamed;
+ALTER PROCEDURE public.noprivs_procedure_renamed (t noprivs_type) RENAME TO noprivs_procedure;
+
+ALTER VIEW public.noprivs_view ALTER COLUMN str SET DEFAULT 'otherstr';
+ALTER VIEW public.noprivs_view ALTER COLUMN str DROP DEFAULT;
+ALTER VIEW public.noprivs_view OWNER TO dba;
+ALTER VIEW public.noprivs_view OWNER TO superdba;
+ALTER VIEW public.noprivs_view OWNER TO noprivs;
+ALTER VIEW public.noprivs_view RENAME COLUMN ary TO ary_renamed;
+ALTER VIEW public.noprivs_view RENAME COLUMN ary_renamed TO ary;
+ALTER VIEW public.noprivs_view RENAME TO noprivs_view_renamed;
+ALTER VIEW public.noprivs_view_renamed RENAME TO noprivs_view;
+ALTER VIEW public.noprivs_view SET SCHEMA noprivs_schema;
+ALTER VIEW noprivs_schema.noprivs_view SET SCHEMA public;
+ALTER VIEW public.noprivs_view SET (check_option = local);
+ALTER VIEW public.noprivs_view SET (check_option = cascaded);
+ALTER VIEW public.noprivs_view RESET (check_option);
+ALTER VIEW public.noprivs_view SET (security_barrier = on);
+ALTER VIEW public.noprivs_view SET (security_barrier = off);
+ALTER VIEW public.noprivs_view RESET (security_barrier);
+
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) OWNER TO dba;
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) OWNER TO superdba;
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) OWNER TO noprivs;
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) SET SCHEMA noprivs_schema;
+ALTER FUNCTION noprivs_schema.noprivs_type_eq (noprivs_type, noprivs_type) SET SCHEMA public;
+ALTER FUNCTION public.noprivs_type_eq (noprivs_type, noprivs_type) DEPENDS ON EXTENSION plpgsql;
+
+ALTER OPERATOR public.=== (noprivs_type, noprivs_type) OWNER TO dba;
+ALTER OPERATOR public.=== (noprivs_type, noprivs_type) OWNER TO superdba;
+ALTER OPERATOR public.=== (noprivs_type, noprivs_type) OWNER TO noprivs;
+ALTER OPERATOR public.=== (noprivs_type, noprivs_type) SET SCHEMA noprivs_schema;
+ALTER OPERATOR noprivs_schema.=== (noprivs_type, noprivs_type) SET SCHEMA public;
+
+RESET SESSION AUTHORIZATION;
+-- Check permissions for dba who has pg_manage_database_objects membership
+SET SESSION AUTHORIZATION dba;
+
+-- attempt to comment on system built-in objects
+COMMENT ON ACCESS METHOD spgist IS 'comment on built-in object';
+COMMENT ON AGGREGATE pg_catalog.avg(int8) IS 'comment on built-in object';
+COMMENT ON CAST (int4 AS int8) IS 'comment on built-in object';
+COMMENT ON COLLATION "nl_NL.UTF-8" IS 'comment on built-in object';
+COMMENT ON CONVERSION utf8_to_windows_1251 IS 'comment on built-in object';
+COMMENT ON DATABASE template1 IS 'comment on built-in object';
+COMMENT ON DOMAIN information_schema.cardinal_number IS 'comment on built-in object';
+COMMENT ON LANGUAGE sql IS 'comment on built-in object';
+COMMENT ON TABLE pg_catalog.pg_class IS 'comment on built-in object';
+COMMENT ON EXTENSION plpgsql IS 'comment on built-in object';
+COMMENT ON OPERATOR CLASS float4_ops USING btree IS 'comment on built-in object';
+COMMENT ON OPERATOR FAMILY float_ops USING btree IS 'comment on built-in object';
+COMMENT ON ROLE pg_read_server_files IS 'comment on built-in object';
+COMMENT ON RULE pg_settings_u ON pg_catalog.pg_settings IS 'comment on built-in object';
+COMMENT ON SCHEMA information_schema IS 'comment on built-in object';
+COMMENT ON TABLE information_schema.sql_features IS 'comment on built-in object';
+COMMENT ON TABLESPACE pg_global IS 'comment on built-in object';
+COMMENT ON VIEW information_schema.foreign_table_options IS 'comment on built-in object';
+COMMENT ON FUNCTION information_schema._pg_expandarray(IN anyarray, OUT x anyelement, OUT n int) IS 'comment on built-in object';
+
+-- attempt to comment on objects owned by superdba
+COMMENT ON AGGREGATE public.superdba_aggregate(int4) IS 'comment on superdba object';
+COMMENT ON CAST (numeric AS text) IS 'comment on superdba object';
+COMMENT ON CAST (text AS numeric) IS 'comment on superdba object';
+COMMENT ON COLLATION public.superdba_collation IS 'comment on superdba object';
+COMMENT ON CONSTRAINT superdba_domconstraint ON DOMAIN superdba_domain IS 'comment on superdba object';
+COMMENT ON CONVERSION superdba_conversion IS 'comment on superdba object';
+COMMENT ON DOMAIN superdba_domain IS 'comment on superdba object';
+COMMENT ON EVENT TRIGGER superdba_event_trigger_start IS 'comment on superdba object';
+COMMENT ON EVENT TRIGGER superdba_event_trigger_end IS 'comment on superdba object';
+COMMENT ON EVENT TRIGGER superdba_event_trigger_rewrite IS 'comment on superdba object';
+COMMENT ON EVENT TRIGGER superdba_event_trigger_drop IS 'comment on superdba object';
+COMMENT ON FUNCTION superdba_event_trigger_func() IS 'comment on superdba object';
+COMMENT ON FUNCTION superdba_trigger_func() IS 'comment on superdba object';
+COMMENT ON TABLE public.superdba_table IS 'comment on superdba object';
+COMMENT ON MATERIALIZED VIEW superdba_matview IS 'comment on superdba object';
+COMMENT ON POLICY superdba_policy ON superdba_table IS 'comment on superdba object';
+COMMENT ON PUBLICATION superdba_publication IS 'comment on superdba object';
+COMMENT ON RULE superdba_rule ON superdba_table IS 'comment on superdba object';
+COMMENT ON SCHEMA superdba_schema IS 'comment on superdba object';
+COMMENT ON SEQUENCE superdba_sequence IS 'comment on superdba object';
+COMMENT ON STATISTICS superdba_statistics IS 'comment on superdba object';
+COMMENT ON SUBSCRIPTION superdba_subscription IS 'comment on superdba object';
+COMMENT ON CONSTRAINT superdba_constraint ON superdba_table IS 'comment on superdba object';
+COMMENT ON TEXT SEARCH PARSER superdba_tsparser IS 'comment on superdba object';
+COMMENT ON TEXT SEARCH TEMPLATE superdba_tstemplate IS 'comment on superdba object';
+COMMENT ON TEXT SEARCH CONFIGURATION superdba_tsconfiguration IS 'comment on superdba object';
+COMMENT ON TEXT SEARCH DICTIONARY superdba_tsdictionary IS 'comment on superdba object';
+COMMENT ON TRIGGER superdba_trigger ON superdba_table IS 'comment on superdba object';
+COMMENT ON TYPE superdba_type IS 'comment on superdba object';
+COMMENT ON PROCEDURE superdba_procedure (t superdba_type) IS 'comment on superdba object';
+COMMENT ON VIEW superdba_view IS 'comment on superdba object';
+COMMENT ON FUNCTION superdba_type_eq (superdba_type, superdba_type) IS 'comment on superdba object';
+COMMENT ON OPERATOR === (superdba_type, superdba_type) IS 'comment on superdba object';
+
+-- attempt to comment on objects owned by privileged user "noprivs"
+COMMENT ON AGGREGATE public.noprivs_aggregate(int4) IS 'comment on noprivs object';
+COMMENT ON COLLATION public.noprivs_collation IS 'comment on noprivs object';
+COMMENT ON CONSTRAINT noprivs_domconstraint ON DOMAIN noprivs_domain IS 'comment on noprivs object';
+COMMENT ON CONVERSION noprivs_conversion IS 'comment on noprivs object';
+COMMENT ON DOMAIN noprivs_domain IS 'comment on noprivs object';
+COMMENT ON FUNCTION noprivs_event_trigger_func() IS 'comment on noprivs object';
+COMMENT ON FUNCTION noprivs_trigger_func() IS 'comment on noprivs object';
+COMMENT ON TABLE public.noprivs_table IS 'comment on noprivs object';
+COMMENT ON TEXT SEARCH CONFIGURATION noprivs_tsconfiguration IS 'comment on noprivs object';
+COMMENT ON MATERIALIZED VIEW noprivs_matview IS 'comment on noprivs object';
+COMMENT ON POLICY noprivs_policy ON noprivs_table IS 'comment on noprivs object';
+COMMENT ON RULE noprivs_rule ON noprivs_table IS 'comment on noprivs object';
+COMMENT ON SCHEMA noprivs_schema IS 'comment on noprivs object';
+COMMENT ON SEQUENCE noprivs_sequence IS 'comment on noprivs object';
+COMMENT ON STATISTICS noprivs_statistics IS 'comment on noprivs object';
+COMMENT ON CONSTRAINT noprivs_constraint ON noprivs_table IS 'comment on noprivs object';
+COMMENT ON TRIGGER noprivs_trigger ON noprivs_table IS 'comment on noprivs object';
+COMMENT ON TYPE noprivs_type IS 'comment on noprivs object';
+COMMENT ON PROCEDURE noprivs_procedure (t noprivs_type) IS 'comment on noprivs object';
+COMMENT ON VIEW noprivs_view IS 'comment on noprivs object';
+COMMENT ON FUNCTION noprivs_type_eq (noprivs_type, noprivs_type) IS 'comment on noprivs object';
+COMMENT ON OPERATOR === (noprivs_type, noprivs_type) IS 'comment on noprivs object';
+
+RESET SESSION AUTHORIZATION;
+-- Check permissions for dba who has pg_manage_database_objects membership
+SET SESSION AUTHORIZATION dba;
+
+-- attempt to drop system built-in objects
+DROP ACCESS METHOD spgist;
+DROP AGGREGATE pg_catalog.avg(int8);
+DROP CAST (int4 AS int8);
+DROP COLLATION "nl_NL.UTF-8";
+DROP CONVERSION utf8_to_windows_1251;
+DROP DATABASE template1;
+DROP DOMAIN information_schema.cardinal_number;
+DROP EXTENSION plpgsql;
+DROP LANGUAGE sql;
+DROP OPERATOR CLASS float4_ops USING btree;
+DROP OPERATOR FAMILY float_ops USING btree;
+DROP ROLE pg_read_server_files;
+DROP RULE pg_settings_u ON pg_catalog.pg_settings;
+DROP TABLE pg_catalog.pg_class;
+DROP SCHEMA information_schema;
+DROP TABLE information_schema.sql_features;
+DROP TABLESPACE pg_global;
+DROP VIEW information_schema.foreign_table_options;
+DROP FUNCTION information_schema._pg_expandarray(IN anyarray, OUT x anyelement, OUT n int);
+
+-- attempt to drop objects owned by superdba
+DROP AGGREGATE public.superdba_aggregate(int4);
+DROP CAST (numeric AS text);
+DROP CAST (text AS numeric);
+DROP TABLE superdba_partA_M;
+DROP TABLE superdba_partM_Z;
+DROP TABLE superdba_partitioned;
+DROP CONVERSION superdba_conversion;
+DROP DOMAIN superdba_domain;
+DROP EVENT TRIGGER superdba_event_trigger_start;
+DROP EVENT TRIGGER superdba_event_trigger_end;
+DROP EVENT TRIGGER superdba_event_trigger_rewrite;
+DROP EVENT TRIGGER superdba_event_trigger_drop;
+DROP FUNCTION superdba_event_trigger_func();
+DROP INDEX superdba_index;
+DROP MATERIALIZED VIEW superdba_matview;
+DROP POLICY superdba_policy ON superdba_table;
+DROP PUBLICATION superdba_publication;
+DROP RULE superdba_rule ON superdba_table;
+DROP SCHEMA superdba_schema;
+DROP STATISTICS superdba_statistics;
+DROP SUBSCRIPTION superdba_subscription;
+DROP VIEW superdba_view;
+ALTER TABLE superdba_table DROP CONSTRAINT superdba_constraint;
+DROP TABLE public.superdba_table;
+DROP COLLATION public.superdba_collation;
+DROP SEQUENCE superdba_sequence;
+DROP TRIGGER superdba_trigger ON superdba_table;
+DROP FUNCTION superdba_trigger_func();
+DROP TEXT SEARCH CONFIGURATION superdba_tsconfiguration;
+DROP TEXT SEARCH DICTIONARY superdba_tsdictionary;
+DROP TEXT SEARCH PARSER superdba_tsparser;
+DROP TEXT SEARCH TEMPLATE superdba_tstemplate;
+DROP TRANSFORM FOR bigint LANGUAGE SQL;
+DROP OPERATOR === (superdba_type, superdba_type);
+DROP FUNCTION superdba_type_eq (superdba_type, superdba_type);
+DROP PROCEDURE superdba_procedure (t superdba_type);
+DROP TYPE superdba_type;
+
+-- attempt to drop objects owned by unprivileged user "noprivs"
+DROP AGGREGATE public.noprivs_aggregate(int4);
+DROP TABLE noprivs_partA_M;
+DROP TABLE noprivs_partM_Z;
+DROP TABLE noprivs_partitioned;
+DROP CONVERSION noprivs_conversion;
+DROP DOMAIN noprivs_domain;
+DROP FUNCTION noprivs_event_trigger_func();
+DROP INDEX noprivs_index;
+DROP MATERIALIZED VIEW noprivs_matview;
+DROP POLICY noprivs_policy ON noprivs_table;
+DROP RULE noprivs_rule ON noprivs_table;
+DROP SCHEMA noprivs_schema;
+DROP STATISTICS noprivs_statistics;
+DROP VIEW noprivs_view;
+ALTER TABLE noprivs_table DROP CONSTRAINT noprivs_constraint;
+DROP TEXT SEARCH CONFIGURATION noprivs_tsconfiguration;
+DROP TEXT SEARCH DICTIONARY noprivs_tsdictionary;
+DROP TRIGGER noprivs_trigger ON noprivs_table;
+DROP TABLE public.noprivs_table;
+DROP COLLATION public.noprivs_collation;
+DROP SEQUENCE noprivs_sequence;
+DROP FUNCTION noprivs_trigger_func();
+DROP OPERATOR === (noprivs_type, noprivs_type);
+DROP FUNCTION noprivs_type_eq (noprivs_type, noprivs_type);
+DROP PROCEDURE noprivs_procedure (t noprivs_type);
+DROP TYPE noprivs_type;
+
+-- attempt to drop users
+DROP USER noprivs;
+DROP USER superdba;
+
+RESET SESSION AUTHORIZATION;
+-- drop remaining objects owned by superdba
+DROP AGGREGATE public.superdba_aggregate(int4);
+DROP CAST (numeric AS text);
+DROP CAST (text AS numeric);
+DROP TABLE superdba_partA_M;
+DROP TABLE superdba_partM_Z;
+DROP TABLE superdba_partitioned;
+DROP CONVERSION superdba_conversion;
+DROP DOMAIN superdba_domain;
+DROP EVENT TRIGGER superdba_event_trigger_start;
+DROP EVENT TRIGGER superdba_event_trigger_end;
+DROP EVENT TRIGGER superdba_event_trigger_rewrite;
+DROP EVENT TRIGGER superdba_event_trigger_drop;
+DROP FUNCTION superdba_event_trigger_func();
+DROP INDEX superdba_index;
+DROP MATERIALIZED VIEW superdba_matview;
+DROP POLICY superdba_policy ON superdba_table;
+DROP PUBLICATION superdba_publication;
+DROP RULE superdba_rule ON superdba_table;
+DROP SCHEMA superdba_schema;
+DROP STATISTICS superdba_statistics;
+DROP SUBSCRIPTION superdba_subscription;
+DROP TRIGGER superdba_trigger ON superdba_table;
+DROP FUNCTION superdba_trigger_func();
+DROP VIEW superdba_view;
+ALTER TABLE superdba_table DROP CONSTRAINT superdba_constraint;
+DROP TABLE public.superdba_table;
+DROP COLLATION public.superdba_collation;
+DROP SEQUENCE superdba_sequence;
+DROP TEXT SEARCH CONFIGURATION superdba_tsconfiguration;
+DROP TEXT SEARCH DICTIONARY superdba_tsdictionary;
+DROP TEXT SEARCH PARSER superdba_tsparser;
+DROP TEXT SEARCH TEMPLATE superdba_tstemplate;
+DROP TRANSFORM FOR bigint LANGUAGE SQL;
+DROP OPERATOR === (superdba_type, superdba_type);
+DROP FUNCTION superdba_type_eq (superdba_type, superdba_type);
+DROP PROCEDURE superdba_procedure (t superdba_type);
+DROP TYPE superdba_type;
+
+-- finished tests relying on these users
+DROP USER dba;
+DROP USER noprivs;
+DROP USER superdba;
-- 
2.21.1 (Apple Git-122.3)

