]> begriffs open source - ai-pg/blob - full-docs/man7/REASSIGN_OWNED.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / REASSIGN_OWNED.7
1 '\" t
2 .\"     Title: REASSIGN 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 "REASSIGN 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 REASSIGN_OWNED \- change the ownership of database objects owned by a database role
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 REASSIGN OWNED BY { \fIold_role\fR | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, \&.\&.\&.]
36                TO { \fInew_role\fR | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
37 .fi
38 .SH "DESCRIPTION"
39 .PP
40 \fBREASSIGN OWNED\fR
41 instructs the system to change the ownership of database objects owned by any of the
42 \fIold_roles\fR
43 to
44 \fInew_role\fR\&.
45 .SH "PARAMETERS"
46 .PP
47 \fIold_role\fR
48 .RS 4
49 The name of a role\&. The ownership of all the objects within the current database, and of all shared objects (databases, tablespaces), owned by this role will be reassigned to
50 \fInew_role\fR\&.
51 .RE
52 .PP
53 \fInew_role\fR
54 .RS 4
55 The name of the role that will be made the new owner of the affected objects\&.
56 .RE
57 .SH "NOTES"
58 .PP
59 \fBREASSIGN OWNED\fR
60 is often used to prepare for the removal of one or more roles\&. Because
61 \fBREASSIGN OWNED\fR
62 does not affect objects within other databases, it is usually necessary to execute this command in each database that contains objects owned by a role that is to be removed\&.
63 .PP
64 \fBREASSIGN OWNED\fR
65 requires membership on both the source role(s) and the target role\&.
66 .PP
67 The
68 \fBDROP OWNED\fR
69 command is an alternative that simply drops all the database objects owned by one or more roles\&.
70 .PP
71 The
72 \fBREASSIGN OWNED\fR
73 command does not affect any privileges granted to the
74 \fIold_roles\fR
75 on objects that are not owned by them\&. Likewise, it does not affect default privileges created with
76 \fBALTER DEFAULT PRIVILEGES\fR\&. Use
77 \fBDROP OWNED\fR
78 to revoke such privileges\&.
79 .PP
80 See
81 Section\ \&21.4
82 for more discussion\&.
83 .SH "COMPATIBILITY"
84 .PP
85 The
86 \fBREASSIGN OWNED\fR
87 command is a
88 PostgreSQL
89 extension\&.
90 .SH "SEE ALSO"
91 DROP OWNED (\fBDROP_OWNED\fR(7)), DROP ROLE (\fBDROP_ROLE\fR(7)), ALTER DATABASE (\fBALTER_DATABASE\fR(7))