codekingpro/portable-devtools
115k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!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 Vsnapshot" /><link rel="prev" href="sql-dropopfamily.html" title="DROP OPERATOR FAMILY" /><link rel="next" href="sql-droppolicy.html" title="DROP POLICY" /></head><body id="docContent" class="container-fluid col-10"><div 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 16.3 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 /></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">3DROP OWNED BY { <em class="replaceable"><code>name</code></em> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] [ CASCADE | RESTRICT ]4</pre></div><div class="refsect1" id="id-1.9.3.122.5"><h2>Description</h2><p>5 <code class="command">DROP OWNED</code> drops all the objects within the current6 database that are owned by one of the specified roles. Any7 privileges granted to the given roles on objects in the current8 database or on shared objects (databases, tablespaces, configuration9 parameters) will also be revoked.10 </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>11 The name of a role whose objects will be dropped, and whose12 privileges will be revoked.13 </p></dd><dt><span class="term"><code class="literal">CASCADE</code></span></dt><dd><p>14 Automatically drop objects that depend on the affected objects,15 and in turn all objects that depend on those objects16 (see <a class="xref" href="ddl-depend.html" title="5.14. Dependency Tracking">Section 5.14</a>).17 </p></dd><dt><span class="term"><code class="literal">RESTRICT</code></span></dt><dd><p>18 Refuse to drop the objects owned by a role if any other database19 objects depend on one of the affected objects. This is the default.20 </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.122.7"><h2>Notes</h2><p>21 <code class="command">DROP OWNED</code> is often used to prepare for the22 removal of one or more roles. Because <code class="command">DROP OWNED</code>23 only affects the objects in the current database, it is usually24 necessary to execute this command in each database that contains25 objects owned by a role that is to be removed.26 </p><p>27 Using the <code class="literal">CASCADE</code> option might make the command28 recurse to objects owned by other users.29 </p><p>30 The <a class="link" href="sql-reassign-owned.html" title="REASSIGN OWNED"><code class="command">REASSIGN OWNED</code></a> command is an alternative that31 reassigns the ownership of all the database objects owned by one or32 more roles. However, <code class="command">REASSIGN OWNED</code> does not deal with33 privileges for other objects.34 </p><p>35 Databases and tablespaces owned by the role(s) will not be removed.36 </p><p>37 See <a class="xref" href="role-removal.html" title="22.4. Dropping Roles">Section 22.4</a> for more discussion.38 </p></div><div class="refsect1" id="id-1.9.3.122.8"><h2>Compatibility</h2><p>39 The <code class="command">DROP OWNED</code> command is a40 <span class="productname">PostgreSQL</span> extension.41 </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" title="DROP OPERATOR FAMILY">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-droppolicy.html" title="DROP POLICY">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" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> DROP POLICY</td></tr></table></div></body></html>