REASSIGN OWNED statement changes the of all database objects (i.e., tables, types, or schemas) in the current database that are currently owned by a specific or .
The
REASSIGN OWNED statement performs a schema change. For more information about how online schema changes work in CockroachDB, see .Required privileges
- To reassign ownership with
REASSIGN OWNED, the user must be a member of the current owner’s role and a member of the target owner’s role. - Members of the can always use
REASSIGN OWNED BY.
Syntax
Parameters
Example
Setup
The following examples use MovR, a fictional vehicle-sharing application, to demonstrate CockroachDB SQL statements. For more information about the MovR example application and dataset, see . To follow along, run to start a temporary, in-memory cluster with themovr dataset preloaded:
Change the owner of all tables in a database
Suppose that the current owner of theusers, vehicles, and rides tables in the movr database is a role named cockroachlabs.
cockroachlabs to a new role named movrlabs.

