]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/dropuser.sgml
New scripts for create/drop user/db from Peter Eisentraut
[postgresql] / doc / src / sgml / ref / dropuser.sgml
1 <!--
2 $Header: /cvsroot/pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.1 1999/12/04 04:53:15 momjian Exp $
3 Postgres documentation
4 -->
5
6 <refentry id="APP-DROPUSER">
7  <refmeta>
8   <refentrytitle id="APP-DROPUSER-TITLE">
9    <application>dropuser</application>
10   </refentrytitle>
11   <refmiscinfo>Application</refmiscinfo>
12  </refmeta>
13  <refnamediv>
14   <refname>
15    <application>dropuser</application>
16   </refname>
17   <refpurpose>
18    Drops (removes) a <productname>Postgres</productname> user
19   </refpurpose>
20  </refnamediv>
21  <refsynopsisdiv>
22   <refsynopsisdivinfo>
23    <date>1999-11-07</date>
24   </refsynopsisdivinfo>
25   <synopsis>
26 dropuser [ <replaceable class="parameter">options</replaceable> ] [ <replaceable class="parameter">username</replaceable> ]
27   </synopsis>
28
29   <refsect2 id="R2-APP-DROPUSER-1">
30    <refsect2info>
31     <date>1999-11-07</date>
32    </refsect2info>
33    <title>
34     Inputs
35    </title>
36    <para>
37
38     <variablelist>
39      <varlistentry>
40       <term>-h, --host <replaceable class="parameter">host</replaceable></term>
41       <listitem>
42        <para>
43         Specifies the hostname of the machine on which the 
44         <application>postmaster</application>
45         is running.
46        </para>
47       </listitem>
48      </varlistentry>
49
50      <varlistentry>
51       <term>-p, --port <replaceable class="parameter">port</replaceable></term>
52       <listitem>
53        <para>
54         Specifies the Internet TCP/IP port or local Unix domain socket file 
55         extension on which the <application>postmaster</application>
56         is listening for connections.
57        </para>
58       </listitem>
59      </varlistentry>
60
61      <varlistentry>
62       <term>-e, --echo</term>
63       <listitem>
64        <para>
65         Echo the queries that <application>createdb</application> generates
66         and sends to the backend.
67        </para>
68       </listitem>
69      </varlistentry>
70
71      <varlistentry>
72       <term>-q, --quiet</term>
73       <listitem>
74        <para>
75         Do not display a response.
76        </para>
77       </listitem>
78      </varlistentry>
79
80      <varlistentry>
81       <term>-i, --interactive</term>
82       <listitem>
83        <para>
84         Prompt for confirmation before actually removing the user.
85        </para>
86       </listitem>
87      </varlistentry>
88
89      <varlistentry>
90       <term><replaceable class="parameter">username</replaceable></term>
91       <listitem>
92        <para>
93         Specifies the name of the <productname>PostgreSQL</productname> user to be removed. 
94         This name must exist in the <productname>Postgres</productname> installation.
95         You will be prompted for a name if none is specified on the command line.
96        </para>
97       </listitem>
98      </varlistentry>
99     </variablelist>
100     </para>
101
102     <para>
103     The options <literal>-h</literal>, <literal>-p</literal>, and <literal>-e</literal>,
104     are passed on literally to <xref linkend="APP-PSQL" endterm="APP-PSQL-title">. If you
105     need the <application>psql</application> options <literal>-U</literal> and
106     <literal>-W</literal> as well, you can uncomment the
107     respective lines in the source. They are disabled by default because of the potential
108     conceptual confusion between existing and new users.
109    </para>
110   </refsect2>
111
112   <refsect2 id="R2-APP-DROPUSER-2">
113    <refsect2info>
114     <date>1999-11-07</date>
115    </refsect2info>
116    <title>
117     Outputs
118    </title>
119
120    <para>
121     <variablelist>
122      <varlistentry>
123       <term><computeroutput>DROP USER</computeroutput></term>
124       <listitem>
125        <para>
126         All is well.
127        </para>
128       </listitem>
129      </varlistentry>
130
131      <varlistentry>
132       <term><computeroutput>dropuser: Deletion of user "<replaceable class="parameter">username</replaceable>" failed.</computeroutput></term>
133       <listitem>
134        <para>
135         Something went wrong. The user was not removed.
136        </para>
137       </listitem>
138      </varlistentry>
139
140     </variablelist>
141
142     If there is an error condition, the backend error message will be displayed.
143     See <xref linkend="SQL-DROPUSER" endterm="SQL-DROPUSER-title">
144     and <xref linkend="APP-PSQL" endterm="APP-PSQL-title"> for possibilities.
145    </para>
146   </refsect2>
147  </refsynopsisdiv>
148
149  <refsect1 id="R1-APP-DROPUSER-1">
150   <refsect1info>
151    <date>1999-11-07</date>
152   </refsect1info>
153   <title>
154    Description
155   </title>
156   <para>
157    <application>dropuser</application> removes an existing
158    <productname>PostgreSQL</productname> user
159    <emphasis>and</emphasis> the databases which that user owned.
160    Only users with <literal>usesuper</literal> set in
161    the <literal>pg_shadow</literal> class can destroy 
162    <productname>PostgreSQL</productname> users.
163   </para>
164
165   <para>
166    <application>dropuser</application> is a shell script wrapper around the
167    <acronym>SQL</acronym> command
168    <xref linkend="SQL-DROPUSER" endterm="SQL-DROPUSER-title"> via
169    the <productname>PostgreSQL</productname> interactive terminal
170    <xref linkend="APP-PSQL" endterm="APP-PSQL-title">. Thus, there is nothing
171    special about removing users via this or other methods. This means
172    that the <application>psql</application> must be found by the script and that
173    a database server is running at the targeted host. Also, any default
174    settings and environment variables available to <application>psql</application>
175    and the <application>libpq</application> front-end library do apply.
176   </para>
177
178  </refsect1>
179
180  <refsect1 id="R1-APP-DROPUSER-2">
181   <refsect1info>
182    <date>1999-11-07</date>
183   </refsect1info>
184   <title>
185    Usage
186   </title>
187   <para>
188    To remove user <literal>joe</literal>
189    from the default database server:
190    <programlisting>
191 $ <userinput>dropuser joe</userinput>
192 DROP USER
193    </programlisting>
194   </para>
195
196   <para>
197    To remove user <literal>joe</literal>
198    using the postmaster on host eden, port 5000, with verification
199    and a peek at the underlying query:
200    <programlisting>
201 $ <userinput>dropuser -p 5000 -h eden -i -e joe</userinput>
202 User "joe" and any owned databases will be permanently deleted.
203 Are you sure? (y/n) <userinput>y</userinput>
204 QUERY: DROP USER "joe"
205 DROP USER
206    </programlisting>
207   </para>
208  </refsect1>
209
210 </refentry>
211
212 <!-- Keep this comment at the end of the file
213 Local variables:
214 mode: sgml
215 sgml-omittag:nil
216 sgml-shorttag:t
217 sgml-minimize-attributes:nil
218 sgml-always-quote-attributes:t
219 sgml-indent-step:1
220 sgml-indent-data:t
221 sgml-parent-document:nil
222 sgml-default-dtd-file:"../reference.ced"
223 sgml-exposed-tags:nil
224 sgml-local-catalogs:"/usr/lib/sgml/catalog"
225 sgml-local-ecat-files:nil
226 End:
227 -->