Postgresql 中文操作指南

DROP OWNED

DROP OWNED — 删除由数据库角色拥有的数据库对象

DROP OWNED — remove database objects owned by a database role

Synopsis

DROP OWNED BY { name | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]

Description

DROP OWNED 删除当前数据库中归一个指定的角色所有的所有对象。还将撤销授予当前数据库中的对象或共享对象(数据库、表空间、配置参数)上的给定角色的任何权限。

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 or on shared objects (databases, tablespaces, configuration parameters) will also be revoked.

Parameters

  • name

    • The name of a role whose objects will be dropped, and whose privileges will be revoked.

  • CASCADE

    • Automatically drop objects that depend on the affected objects, and in turn all objects that depend on those objects (see Section 5.14).

  • RESTRICT

    • Refuse to drop the objects owned by a role if any other database objects depend on one of the affected objects. This is the default.

Notes

DROP OWNED 通常用于准备删除一个或多个角色。由于 DROP OWNED 仅影响当前数据库中的对象,因此通常需要在包含待删除角色所有对象的所有数据库中执行此命令。

DROP OWNED is often used to prepare for the removal of one or more roles. Because DROP OWNED only affects the objects in the current database, it is usually necessary to execute this command in each database that contains objects owned by a role that is to be removed.

使用 CASCADE 选项可能会使命令递归到其他用户拥有的对象。

Using the CASCADE option might make the command recurse to objects owned by other users.

REASSIGN OWNED 命令是一个备选命令,可重新分配一个或多个角色拥有所有数据库对象的所有权。但是, REASSIGN OWNED 不处理其他对象的权限。

The REASSIGN OWNED command is an alternative that reassigns the ownership of all the database objects owned by one or more roles. However, REASSIGN OWNED does not deal with privileges for other objects.

该角色所有的数据库和表空间将不会被删除。

Databases and tablespaces owned by the role(s) will not be removed.

有关更多讨论,请参阅 Section 22.4

See Section 22.4 for more discussion.

Compatibility

DROP OWNED 命令是 PostgreSQL 的扩展。

The DROP OWNED command is a PostgreSQL extension.