2 doc/src/sgml/ref/reassign_owned.sgml
3 PostgreSQL documentation
6 <refentry id="SQL-REASSIGN-OWNED">
8 <refentrytitle>REASSIGN OWNED</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
14 <refname>REASSIGN OWNED</refname>
15 <refpurpose>change the ownership of database objects owned by a database role</refpurpose>
18 <indexterm zone="sql-reassign-owned">
19 <primary>REASSIGN OWNED</primary>
24 REASSIGN OWNED BY <replaceable class="PARAMETER">old_role</replaceable> [, ...] TO <replaceable class="PARAMETER">new_role</replaceable>
29 <title>Description</title>
32 <command>REASSIGN OWNED</command> instructs the system to change
33 the ownership of the database objects owned by one of the
34 old_roles, to new_role.
39 <title>Parameters</title>
43 <term><replaceable class="PARAMETER">old_role</replaceable></term>
46 The name of a role. The ownership of all the objects in the
47 current database owned by this role will be reassigned to
48 <replaceable class="PARAMETER">new_role</replaceable>.
54 <term><replaceable class="PARAMETER">new_role</replaceable></term>
57 The name of the role that will be made the new owner of the
69 <command>REASSIGN OWNED</command> is often used to prepare for the
70 removal of one or more roles. Because <command>REASSIGN
71 OWNED</command> only affects the objects in the current database,
72 it is usually necessary to execute this command in each database
73 that contains objects owned by a role that is to be removed.
77 <command>REASSIGN OWNED</command> requires privileges on both the
78 source role(s) and the target role.
82 The <xref linkend="sql-drop-owned"> command is an alternative that
83 drops all the database objects owned by one or more roles. Note
84 also that <command>DROP OWNED</command> requires privileges only
85 on the source role(s).
89 The <command>REASSIGN OWNED</command> command does not affect the
90 privileges granted to the old_roles in objects that are not owned
91 by them. Use <command>DROP OWNED</command> to revoke those
96 The <command>REASSIGN OWNED</command> command does not affect the
97 ownership of any databases owned by the role. Use
98 <xref linkend="sql-alterdatabase"> to reassign that ownership.
104 <title>Compatibility</title>
107 The <command>REASSIGN OWNED</command> statement is a
108 <productname>PostgreSQL</productname> extension.
113 <title>See Also</title>
115 <simplelist type="inline">
116 <member><xref linkend="sql-drop-owned"></member>
117 <member><xref linkend="sql-droprole"></member>
118 <member><xref linkend="sql-alterdatabase"></member>