2005-07-27 01:24:02 +02:00
|
|
|
<!--
|
2006-09-16 02:30:20 +02:00
|
|
|
$PostgreSQL: pgsql/doc/src/sgml/ref/drop_role.sgml,v 1.5 2006/09/16 00:30:18 momjian Exp $
|
2005-07-27 01:24:02 +02:00
|
|
|
PostgreSQL documentation
|
|
|
|
-->
|
|
|
|
|
|
|
|
<refentry id="SQL-DROPROLE">
|
|
|
|
<refmeta>
|
|
|
|
<refentrytitle id="SQL-DROPROLE-TITLE">DROP ROLE</refentrytitle>
|
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
<refname>DROP ROLE</refname>
|
|
|
|
<refpurpose>remove a database role</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<indexterm zone="sql-droprole">
|
|
|
|
<primary>DROP ROLE</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<synopsis>
|
2006-02-04 20:06:47 +01:00
|
|
|
DROP ROLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...]
|
2005-07-27 01:24:02 +02:00
|
|
|
</synopsis>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<command>DROP ROLE</command> removes the specified role(s).
|
|
|
|
To drop a superuser role, you must be a superuser yourself;
|
|
|
|
to drop non-superuser roles, you must have <literal>CREATEROLE</>
|
|
|
|
privilege.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
A role cannot be removed if it is still referenced in any database
|
|
|
|
of the cluster; an error will be raised if so. Before dropping the role,
|
|
|
|
you must drop all the objects it owns (or reassign their ownership)
|
2006-04-02 06:02:40 +02:00
|
|
|
and revoke any privileges the role has been granted. The <xref
|
|
|
|
linkend="sql-reassign-owned" endterm="sql-reassign-owned-title">
|
|
|
|
and <xref linkend="sql-drop-owned" endterm="sql-drop-owned-title">
|
|
|
|
commands can be useful for this purpose.
|
2005-07-27 01:24:02 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
However, it is not necessary to remove role memberships involving
|
|
|
|
the role; <command>DROP ROLE</> automatically revokes any memberships
|
|
|
|
of the target role in other roles, and of other roles in the target role.
|
|
|
|
The other roles are not dropped nor otherwise affected.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Parameters</title>
|
|
|
|
|
2006-02-04 20:06:47 +01:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><literal>IF EXISTS</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Do not throw an error if the role does not exist. A notice is issued
|
|
|
|
in this case.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2005-07-27 01:24:02 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable class="PARAMETER">name</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The name of the role to remove.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Notes</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<productname>PostgreSQL</productname> includes a program <xref
|
|
|
|
linkend="APP-DROPUSER" endterm="APP-DROPUSER-title"> that has the
|
|
|
|
same functionality as this command (in fact, it calls this command)
|
|
|
|
but can be run from the command shell.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Examples</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To drop a role:
|
|
|
|
<programlisting>
|
|
|
|
DROP ROLE jonathan;
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Compatibility</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The SQL standard defines <command>DROP ROLE</command>, but it allows
|
|
|
|
only one role to be dropped at a time, and it specifies different
|
|
|
|
privilege requirements than <productname>PostgreSQL</productname> uses.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
|
|
|
<member><xref linkend="sql-createrole" endterm="sql-createrole-title"></member>
|
|
|
|
<member><xref linkend="sql-alterrole" endterm="sql-alterrole-title"></member>
|
|
|
|
<member><xref linkend="sql-set-role" endterm="sql-set-role-title"></member>
|
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
</refentry>
|