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