REASSIGN OWNED

This page documents the preview version (v2.23). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.

Synopsis

Use the REASSIGN OWNED statement to change the ownership of database objects owned by any of the old_roles to new_role.

Syntax

reassign_owned ::= REASSIGN OWNED BY role_specification [ , ... ] TO 
                   role_specification

role_specification ::= role_name | CURRENT_USER | SESSION_USER

reassign_owned

REASSIGNOWNEDBY,role_specificationTOrole_specification

role_specification

role_nameCURRENT_USERSESSION_USER

Semantics

REASSIGN OWNED is typically used to prepare for the removal of a role. It requires membership on both the source roles and target role.

Examples

  • Reassign all objects owned by john to yugabyte.
yugabyte=# reassign owned by john to yugabyte;

See also