Synopsis

Use the DROP OWNED statement to drop all database 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 will also be revoked.

Syntax

drop_owned ::= DROP OWNED BY role_specification [ , ... ] 
               [ CASCADE | RESTRICT ]

role_specification ::= role_name | CURRENT_USER | SESSION_USER

drop_owned

DROPOWNEDBY,role_specificationCASCADERESTRICT

role_specification

role_nameCURRENT_USERSESSION_USER

Semantics

  • CASCADE

Automatically drop objects that depend on the affected objects.

  • RESTRICT

This is the default mode and will raise an error if there are other database objects that depend on the dropped objects.

Examples

  • Drop all objects owned by john.
yugabyte=# drop owned by john;

See also