~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-proposed

« back to all changes in this revision

Viewing changes to doc/src/sgml/ref/drop_role.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-20 12:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090320120013-hogj7egc5mjncc5g
Tags: upstream-8.4~0cvs20090328
ImportĀ upstreamĀ versionĀ 8.4~0cvs20090328

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!--
 
2
$PostgreSQL$
 
3
PostgreSQL documentation
 
4
-->
 
5
 
 
6
<refentry id="SQL-DROPROLE">
 
7
 <refmeta>
 
8
  <refentrytitle id="SQL-DROPROLE-TITLE">DROP ROLE</refentrytitle>
 
9
  <manvolnum>7</manvolnum>
 
10
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 
11
 </refmeta>
 
12
 
 
13
 <refnamediv>
 
14
  <refname>DROP ROLE</refname>
 
15
  <refpurpose>remove a database role</refpurpose>
 
16
 </refnamediv>
 
17
 
 
18
 <indexterm zone="sql-droprole">
 
19
  <primary>DROP ROLE</primary>
 
20
 </indexterm>
 
21
 
 
22
 <refsynopsisdiv>
 
23
<synopsis>
 
24
DROP ROLE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...]
 
25
</synopsis>
 
26
 </refsynopsisdiv>
 
27
 
 
28
 <refsect1>
 
29
  <title>Description</title>
 
30
 
 
31
  <para>
 
32
   <command>DROP ROLE</command> removes the specified role(s).
 
33
   To drop a superuser role, you must be a superuser yourself;
 
34
   to drop non-superuser roles, you must have <literal>CREATEROLE</>
 
35
   privilege.
 
36
  </para>
 
37
 
 
38
  <para>
 
39
   A role cannot be removed if it is still referenced in any database
 
40
   of the cluster; an error will be raised if so.  Before dropping the role,
 
41
   you must drop all the objects it owns (or reassign their ownership)
 
42
   and revoke any privileges the role has been granted. The <xref
 
43
   linkend="sql-reassign-owned" endterm="sql-reassign-owned-title">
 
44
   and <xref linkend="sql-drop-owned" endterm="sql-drop-owned-title">
 
45
   commands can be useful for this purpose.
 
46
  </para>
 
47
 
 
48
  <para>
 
49
   However, it is not necessary to remove role memberships involving
 
50
   the role; <command>DROP ROLE</> automatically revokes any memberships
 
51
   of the target role in other roles, and of other roles in the target role.
 
52
   The other roles are not dropped nor otherwise affected.
 
53
  </para>
 
54
 </refsect1>
 
55
 
 
56
 <refsect1>
 
57
  <title>Parameters</title>
 
58
 
 
59
  <variablelist>
 
60
   <varlistentry>
 
61
    <term><literal>IF EXISTS</literal></term>
 
62
    <listitem>
 
63
     <para>
 
64
      Do not throw an error if the role does not exist. A notice is issued 
 
65
      in this case.
 
66
     </para>
 
67
    </listitem>
 
68
   </varlistentry>
 
69
 
 
70
   <varlistentry>
 
71
    <term><replaceable class="PARAMETER">name</replaceable></term>
 
72
    <listitem>
 
73
     <para>
 
74
      The name of the role to remove.
 
75
     </para>
 
76
    </listitem>
 
77
   </varlistentry>
 
78
  </variablelist>
 
79
 </refsect1>
 
80
 
 
81
 <refsect1>
 
82
  <title>Notes</title>
 
83
 
 
84
  <para>
 
85
   <productname>PostgreSQL</productname> includes a program <xref
 
86
   linkend="APP-DROPUSER" endterm="APP-DROPUSER-title"> that has the
 
87
   same functionality as this command (in fact, it calls this command)
 
88
   but can be run from the command shell.
 
89
  </para>
 
90
 </refsect1>
 
91
 
 
92
 <refsect1>
 
93
  <title>Examples</title>
 
94
 
 
95
  <para>
 
96
   To drop a role:
 
97
<programlisting>
 
98
DROP ROLE jonathan;
 
99
</programlisting>
 
100
  </para>
 
101
 </refsect1>
 
102
 
 
103
 <refsect1>
 
104
  <title>Compatibility</title>
 
105
  
 
106
  <para>
 
107
   The SQL standard defines <command>DROP ROLE</command>, but it allows
 
108
   only one role to be dropped at a time, and it specifies different
 
109
   privilege requirements than <productname>PostgreSQL</productname> uses.
 
110
  </para>
 
111
 </refsect1>
 
112
 
 
113
 <refsect1>
 
114
  <title>See Also</title>
 
115
 
 
116
  <simplelist type="inline">
 
117
   <member><xref linkend="sql-createrole" endterm="sql-createrole-title"></member>
 
118
   <member><xref linkend="sql-alterrole" endterm="sql-alterrole-title"></member>
 
119
   <member><xref linkend="sql-set-role" endterm="sql-set-role-title"></member>
 
120
  </simplelist>
 
121
 </refsect1>
 
122
 
 
123
</refentry>