1DROP OWNED(7) PostgreSQL 15.4 Documentation DROP OWNED(7)
2
3
4
6 DROP_OWNED - remove database objects owned by a database role
7
9 DROP OWNED BY { name | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]
10
12 DROP OWNED drops all the objects within the current database that are
13 owned by one of the specified roles. Any privileges granted to the
14 given roles on objects in the current database or on shared objects
15 (databases, tablespaces, configuration parameters) will also be
16 revoked.
17
19 name
20 The name of a role whose objects will be dropped, and whose
21 privileges will be revoked.
22
23 CASCADE
24 Automatically drop objects that depend on the affected objects, and
25 in turn all objects that depend on those objects (see
26 Section 5.14).
27
28 RESTRICT
29 Refuse to drop the objects owned by a role if any other database
30 objects depend on one of the affected objects. This is the default.
31
33 DROP OWNED is often used to prepare for the removal of one or more
34 roles. Because DROP OWNED only affects the objects in the current
35 database, it is usually necessary to execute this command in each
36 database that contains objects owned by a role that is to be removed.
37
38 Using the CASCADE option might make the command recurse to objects
39 owned by other users.
40
41 The REASSIGN OWNED command is an alternative that reassigns the
42 ownership of all the database objects owned by one or more roles.
43 However, REASSIGN OWNED does not deal with privileges for other
44 objects.
45
46 Databases and tablespaces owned by the role(s) will not be removed.
47
48 See Section 22.4 for more discussion.
49
51 The DROP OWNED command is a PostgreSQL extension.
52
54 REASSIGN OWNED (REASSIGN_OWNED(7)), DROP ROLE (DROP_ROLE(7))
55
56
57
58PostgreSQL 15.4 2023 DROP OWNED(7)