1REASSIGN OWNED(7) PostgreSQL 13.3 Documentation REASSIGN OWNED(7)
2
3
4
6 REASSIGN_OWNED - change the ownership of database objects owned by a
7 database role
8
10 REASSIGN OWNED BY { old_role | CURRENT_USER | SESSION_USER } [, ...]
11 TO { new_role | CURRENT_USER | SESSION_USER }
12
14 REASSIGN OWNED instructs the system to change the ownership of database
15 objects owned by any of the old_roles to new_role.
16
18 old_role
19 The name of a role. The ownership of all the objects within the
20 current database, and of all shared objects (databases,
21 tablespaces), owned by this role will be reassigned to new_role.
22
23 new_role
24 The name of the role that will be made the new owner of the
25 affected objects.
26
28 REASSIGN OWNED is often used to prepare for the removal of one or more
29 roles. Because REASSIGN OWNED does not affect objects within other
30 databases, it is usually necessary to execute this command in each
31 database that contains objects owned by a role that is to be removed.
32
33 REASSIGN OWNED requires membership on both the source role(s) and the
34 target role.
35
36 The DROP OWNED (DROP_OWNED(7)) command is an alternative that simply
37 drops all the database objects owned by one or more roles.
38
39 The REASSIGN OWNED command does not affect any privileges granted to
40 the old_roles on objects that are not owned by them. Likewise, it does
41 not affect default privileges created with ALTER DEFAULT PRIVILEGES.
42 Use DROP OWNED to revoke such privileges.
43
44 See Section 21.4 for more discussion.
45
47 The REASSIGN OWNED command is a PostgreSQL extension.
48
50 DROP OWNED (DROP_OWNED(7)), DROP ROLE (DROP_ROLE(7)), ALTER DATABASE
51 (ALTER_DATABASE(7))
52
53
54
55PostgreSQL 13.3 2021 REASSIGN OWNED(7)