diff --git a/doc/src/sgml/ref/drop_owned.sgml b/doc/src/sgml/ref/drop_owned.sgml index 6276f8e928e..34c091c0c10 100644 --- a/doc/src/sgml/ref/drop_owned.sgml +++ b/doc/src/sgml/ref/drop_owned.sgml @@ -28,10 +28,11 @@ DROP OWNED BY name [, ...] [ CASCAD Description - DROP OWNED drops all the objects in the current + DROP OWNED drops all the objects within the current database that are owned by one of the specified roles. Any privileges granted to the given roles on objects in the current - database will also be revoked. + database and on shared objects (databases, tablespaces) will also be + revoked. @@ -91,6 +92,10 @@ DROP OWNED BY name [, ...] [ CASCAD reassigns the ownership of all the database objects owned by one or more roles. + + + Databases and tablespaces owned by the role(s) will not be removed. + diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c index 6f4d52c1730..b44d2a28480 100644 --- a/src/backend/catalog/pg_shdepend.c +++ b/src/backend/catalog/pg_shdepend.c @@ -1221,11 +1221,14 @@ shdepDropOwned(List *roleids, DropBehavior behavior) ExecGrantStmt_oids(&istmt); break; case SHARED_DEPENDENCY_OWNER: - /* Save it for deletion below */ - obj.classId = sdepForm->classid; - obj.objectId = sdepForm->objid; - obj.objectSubId = 0; - add_exact_object_address(&obj, deleteobjs); + /* If a local object, save it for deletion below */ + if (sdepForm->dbid == MyDatabaseId) + { + obj.classId = sdepForm->classid; + obj.objectId = sdepForm->objid; + obj.objectSubId = 0; + add_exact_object_address(&obj, deleteobjs); + } break; } }