|
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>DROP OWNED</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="sql-dropopfamily.html" title="DROP OPERATOR FAMILY" /><link rel="next" href="sql-droppolicy.html" title="DROP POLICY" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">DROP OWNED</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-dropopfamily.html" title="DROP OPERATOR FAMILY">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-droppolicy.html" title="DROP POLICY">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="SQL-DROP-OWNED"><div class="titlepage"></div><a id="id-1.9.3.122.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">DROP OWNED</span></h2><p>DROP OWNED — remove database objects owned by a database role</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
- DROP OWNED BY { <em class="replaceable"><code>name</code></em> | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]
- </pre></div><div class="refsect1" id="id-1.9.3.122.5"><h2>Description</h2><p>
- <code class="command">DROP OWNED</code> 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) will also be
- revoked.
- </p></div><div class="refsect1" id="id-1.9.3.122.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd><p>
- The name of a role whose objects will be dropped, and whose
- privileges will be revoked.
- </p></dd><dt><span class="term"><code class="literal">CASCADE</code></span></dt><dd><p>
- Automatically drop objects that depend on the affected objects,
- and in turn all objects that depend on those objects
- (see <a class="xref" href="ddl-depend.html" title="5.14. Dependency Tracking">Section 5.14</a>).
- </p></dd><dt><span class="term"><code class="literal">RESTRICT</code></span></dt><dd><p>
- 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.
- </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.122.7"><h2>Notes</h2><p>
- <code class="command">DROP OWNED</code> is often used to prepare for the
- removal of one or more roles. Because <code class="command">DROP OWNED</code>
- 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.
- </p><p>
- Using the <code class="literal">CASCADE</code> option might make the command
- recurse to objects owned by other users.
- </p><p>
- The <a class="xref" href="sql-reassign-owned.html" title="REASSIGN OWNED"><span class="refentrytitle">REASSIGN OWNED</span></a> command is an alternative that
- reassigns the ownership of all the database objects owned by one or
- more roles. However, <code class="command">REASSIGN OWNED</code> does not deal with
- privileges for other objects.
- </p><p>
- Databases and tablespaces owned by the role(s) will not be removed.
- </p><p>
- See <a class="xref" href="role-removal.html" title="21.4. Dropping Roles">Section 21.4</a> for more discussion.
- </p></div><div class="refsect1" id="id-1.9.3.122.8"><h2>Compatibility</h2><p>
- The <code class="command">DROP OWNED</code> command is a
- <span class="productname">PostgreSQL</span> extension.
- </p></div><div class="refsect1" id="id-1.9.3.122.9"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-reassign-owned.html" title="REASSIGN OWNED"><span class="refentrytitle">REASSIGN OWNED</span></a>, <a class="xref" href="sql-droprole.html" title="DROP ROLE"><span class="refentrytitle">DROP ROLE</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-dropopfamily.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-droppolicy.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">DROP OPERATOR FAMILY </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> DROP POLICY</td></tr></table></div></body></html>
|