]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/reassign_owned.sgml
Fix psql doc typo.
[postgresql] / doc / src / sgml / ref / reassign_owned.sgml
1 <!--
2 doc/src/sgml/ref/reassign_owned.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-REASSIGN-OWNED">
7  <refmeta>
8   <refentrytitle>REASSIGN OWNED</refentrytitle>
9   <manvolnum>7</manvolnum>
10   <refmiscinfo>SQL - Language Statements</refmiscinfo>
11  </refmeta>
12
13  <refnamediv>
14   <refname>REASSIGN OWNED</refname>
15   <refpurpose>change the ownership of database objects owned by a database role</refpurpose>
16  </refnamediv>
17
18  <indexterm zone="sql-reassign-owned">
19   <primary>REASSIGN OWNED</primary>
20  </indexterm>
21
22  <refsynopsisdiv>
23 <synopsis>
24 REASSIGN OWNED BY <replaceable class="PARAMETER">old_role</replaceable> [, ...] TO <replaceable class="PARAMETER">new_role</replaceable>
25 </synopsis>
26  </refsynopsisdiv>
27
28  <refsect1>
29   <title>Description</title>
30
31   <para>
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.
35   </para>
36  </refsect1>
37
38  <refsect1>
39   <title>Parameters</title>
40
41   <variablelist>
42    <varlistentry>
43     <term><replaceable class="PARAMETER">old_role</replaceable></term>
44     <listitem>
45      <para>
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>.
49      </para>
50     </listitem>
51    </varlistentry>
52
53    <varlistentry>
54     <term><replaceable class="PARAMETER">new_role</replaceable></term>
55     <listitem>
56      <para>
57       The name of the role that will be made the new owner of the
58       affected objects.
59      </para>
60     </listitem>
61    </varlistentry>
62   </variablelist>
63  </refsect1>
64
65  <refsect1>
66   <title>Notes</title>
67
68   <para>
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.
74   </para>
75
76   <para>
77    <command>REASSIGN OWNED</command> requires privileges on both the
78    source role(s) and the target role.
79   </para>
80
81   <para>
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).
86   </para>
87
88   <para>
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
92    privileges.
93   </para>
94
95   <para>
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.
99   </para>
100
101  </refsect1>
102
103  <refsect1>
104   <title>Compatibility</title>
105
106   <para>
107    The <command>REASSIGN OWNED</command> statement is a
108    <productname>PostgreSQL</productname> extension.
109   </para>
110  </refsect1>
111
112  <refsect1>
113   <title>See Also</title>
114
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>
119   </simplelist>
120  </refsect1>
121
122 </refentry>