]> begriffs open source - ai-pg/blob - full-docs/man7/DROP_OWNED.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / DROP_OWNED.7
1 '\" t
2 .\"     Title: DROP OWNED
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "DROP OWNED" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 DROP_OWNED \- remove database objects owned by a database role
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 DROP OWNED BY { \fIname\fR | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, \&.\&.\&.] [ CASCADE | RESTRICT ]
36 .fi
37 .SH "DESCRIPTION"
38 .PP
39 \fBDROP OWNED\fR
40 drops all the objects within the current database that are owned by one of the specified roles\&. Any privileges granted to the given roles on objects in the current database or on shared objects (databases, tablespaces, configuration parameters) will also be revoked\&.
41 .SH "PARAMETERS"
42 .PP
43 \fIname\fR
44 .RS 4
45 The name of a role whose objects will be dropped, and whose privileges will be revoked\&.
46 .RE
47 .PP
48 CASCADE
49 .RS 4
50 Automatically drop objects that depend on the affected objects, and in turn all objects that depend on those objects (see
51 Section\ \&5.15)\&.
52 .RE
53 .PP
54 RESTRICT
55 .RS 4
56 Refuse to drop the objects owned by a role if any other database objects depend on one of the affected objects\&. This is the default\&.
57 .RE
58 .SH "NOTES"
59 .PP
60 \fBDROP OWNED\fR
61 is often used to prepare for the removal of one or more roles\&. Because
62 \fBDROP OWNED\fR
63 only affects the objects in the current database, it is usually necessary to execute this command in each database that contains objects owned by a role that is to be removed\&.
64 .PP
65 Using the
66 CASCADE
67 option might make the command recurse to objects owned by other users\&.
68 .PP
69 The
70 \fBREASSIGN OWNED\fR
71 command is an alternative that reassigns the ownership of all the database objects owned by one or more roles\&. However,
72 \fBREASSIGN OWNED\fR
73 does not deal with privileges for other objects\&.
74 .PP
75 Databases and tablespaces owned by the role(s) will not be removed\&.
76 .PP
77 See
78 Section\ \&21.4
79 for more discussion\&.
80 .SH "COMPATIBILITY"
81 .PP
82 The
83 \fBDROP OWNED\fR
84 command is a
85 PostgreSQL
86 extension\&.
87 .SH "SEE ALSO"
88 REASSIGN OWNED (\fBREASSIGN_OWNED\fR(7)), DROP ROLE (\fBDROP_ROLE\fR(7))