REASSIGN OWNED changes the owner of a database.
REASSIGN OWNED requires that the system change owners of all the database objects owned by old_role to new_role.
1 | REASSIGN OWNED BY old_role [, ...] TO new_role; |
Specifies the role name of the old owner.
Specifies the role name of the new owner.
Create two users:
1 2 | CREATE USER joe PASSWORD '{Password}'; CREATE USER jack PASSWORD '{Password}'; |
Reassign all database objects owned by the joe and jack roles to admin:
1 | REASSIGN OWNED BY joe, jack TO dbadmin; |