| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/drop_owned.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-drop-owned"> |
| 7 |
<indexterm zone="sql-drop-owned"> |
| 8 |
<primary>DROP OWNED</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>DROP OWNED</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>DROP OWNED</refname> |
| 19 |
<refpurpose>remove database objects owned by a database role</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<synopsis> |
| 24 |
DROP OWNED BY { <replaceable class="parameter">name</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ] |
| 25 |
</synopsis> |
| 26 |
</refsynopsisdiv> |
| 27 |
|
| 28 |
<refsect1> |
| 29 |
<title>Description</title> |
| 30 |
|
| 31 |
<para> |
| 32 |
<command>DROP OWNED</command> drops all the objects within the current |
| 33 |
database that are owned by one of the specified roles. Any |
| 34 |
privileges granted to the given roles on objects in the current |
| 35 |
database or on shared objects (databases, tablespaces, configuration |
| 36 |
parameters) will also be revoked. |
| 37 |
</para> |
| 38 |
</refsect1> |
| 39 |
|
| 40 |
<refsect1> |
| 41 |
<title>Parameters</title> |
| 42 |
|
| 43 |
<variablelist> |
| 44 |
<varlistentry> |
| 45 |
<term><replaceable class="parameter">name</replaceable></term> |
| 46 |
<listitem> |
| 47 |
<para> |
| 48 |
The name of a role whose objects will be dropped, and whose |
| 49 |
privileges will be revoked. |
| 50 |
</para> |
| 51 |
</listitem> |
| 52 |
</varlistentry> |
| 53 |
|
| 54 |
<varlistentry> |
| 55 |
<term><literal>CASCADE</literal></term> |
| 56 |
<listitem> |
| 57 |
<para> |
| 58 |
Automatically drop objects that depend on the affected objects, |
| 59 |
and in turn all objects that depend on those objects |
| 60 |
(see <xref linkend="ddl-depend"/>). |
| 61 |
</para> |
| 62 |
</listitem> |
| 63 |
</varlistentry> |
| 64 |
|
| 65 |
<varlistentry> |
| 66 |
<term><literal>RESTRICT</literal></term> |
| 67 |
<listitem> |
| 68 |
<para> |
| 69 |
Refuse to drop the objects owned by a role if any other database |
| 70 |
objects depend on one of the affected objects. This is the default. |
| 71 |
</para> |
| 72 |
</listitem> |
| 73 |
</varlistentry> |
| 74 |
</variablelist> |
| 75 |
</refsect1> |
| 76 |
|
| 77 |
<refsect1> |
| 78 |
<title>Notes</title> |
| 79 |
<para> |
| 80 |
<command>DROP OWNED</command> is often used to prepare for the |
| 81 |
removal of one or more roles. Because <command>DROP OWNED</command> |
| 82 |
only affects the objects in the current database, it is usually |
| 83 |
necessary to execute this command in each database that contains |
| 84 |
objects owned by a role that is to be removed. |
| 85 |
</para> |
| 86 |
|
| 87 |
<para> |
| 88 |
Using the <literal>CASCADE</literal> option might make the command |
| 89 |
recurse to objects owned by other users. |
| 90 |
</para> |
| 91 |
|
| 92 |
<para> |
| 93 |
The <link linkend="sql-reassign-owned"><command>REASSIGN OWNED</command></link> command is an alternative that |
| 94 |
reassigns the ownership of all the database objects owned by one or |
| 95 |
more roles. However, <command>REASSIGN OWNED</command> does not deal with |
| 96 |
privileges for other objects. |
| 97 |
</para> |
| 98 |
|
| 99 |
<para> |
| 100 |
Databases and tablespaces owned by the role(s) will not be removed. |
| 101 |
</para> |
| 102 |
|
| 103 |
<para> |
| 104 |
See <xref linkend="role-removal"/> for more discussion. |
| 105 |
</para> |
| 106 |
</refsect1> |
| 107 |
|
| 108 |
<refsect1> |
| 109 |
<title>Compatibility</title> |
| 110 |
|
| 111 |
<para> |
| 112 |
The <command>DROP OWNED</command> command is a |
| 113 |
<productname>PostgreSQL</productname> extension. |
| 114 |
</para> |
| 115 |
</refsect1> |
| 116 |
|
| 117 |
<refsect1> |
| 118 |
<title>See Also</title> |
| 119 |
|
| 120 |
<simplelist type="inline"> |
| 121 |
<member><xref linkend="sql-reassign-owned"/></member> |
| 122 |
<member><xref linkend="sql-droprole"/></member> |
| 123 |
</simplelist> |
| 124 |
</refsect1> |
| 125 |
|
| 126 |
</refentry> |