2 doc/src/sgml/ref/dropuser.sgml
3 PostgreSQL documentation
6 <refentry id="APP-DROPUSER">
8 <refentrytitle><application>dropuser</application></refentrytitle>
9 <manvolnum>1</manvolnum>
10 <refmiscinfo>Application</refmiscinfo>
14 <refname>dropuser</refname>
15 <refpurpose>remove a <productname>PostgreSQL</productname> user account</refpurpose>
18 <indexterm zone="app-dropuser">
19 <primary>dropuser</primary>
24 <command>dropuser</command>
25 <arg rep="repeat"><replaceable>connection-option</replaceable></arg>
26 <arg rep="repeat"><replaceable>option</replaceable></arg>
27 <arg><replaceable>username</replaceable></arg>
33 <title>Description</title>
36 <application>dropuser</application> removes an existing
37 <productname>PostgreSQL</productname> user.
38 Only superusers and users with the <literal>CREATEROLE</> privilege can
39 remove <productname>PostgreSQL</productname> users. (To remove a
40 superuser, you must yourself be a superuser.)
44 <application>dropuser</application> is a wrapper around the
45 <acronym>SQL</acronym> command <xref linkend="SQL-DROPROLE">.
46 There is no effective difference between dropping users via
47 this utility and via other methods for accessing the server.
54 <title>Options</title>
57 <application>dropuser</application> accepts the following command-line arguments:
61 <term><replaceable class="parameter">username</replaceable></term>
64 Specifies the name of the <productname>PostgreSQL</productname> user to be removed.
65 You will be prompted for a name if none is specified on the command line.
71 <term><option>-e</></term>
72 <term><option>--echo</></term>
75 Echo the commands that <application>dropuser</application> generates
76 and sends to the server.
82 <term><option>-i</></term>
83 <term><option>--interactive</></term>
86 Prompt for confirmation before actually removing the user.
92 <term><option>-V</></term>
93 <term><option>--version</></term>
96 Print the <application>dropuser</application> version and exit.
102 <term><option>-?</></term>
103 <term><option>--help</></term>
106 Show help about <application>dropuser</application> command line
116 <application>dropuser</application> also accepts the following
117 command-line arguments for connection parameters:
121 <term><option>-h <replaceable class="parameter">host</replaceable></></term>
122 <term><option>--host <replaceable class="parameter">host</replaceable></></term>
125 Specifies the host name of the machine on which the
127 is running. If the value begins with a slash, it is used
128 as the directory for the Unix domain socket.
134 <term><option>-p <replaceable class="parameter">port</replaceable></></term>
135 <term><option>--port <replaceable class="parameter">port</replaceable></></term>
138 Specifies the TCP port or local Unix domain socket file
139 extension on which the server
140 is listening for connections.
146 <term><option>-U <replaceable class="parameter">username</replaceable></></term>
147 <term><option>--username <replaceable class="parameter">username</replaceable></></term>
150 User name to connect as (not the user name to drop).
156 <term><option>-w</></term>
157 <term><option>--no-password</></term>
160 Never issue a password prompt. If the server requires
161 password authentication and a password is not available by
162 other means such as a <filename>.pgpass</filename> file, the
163 connection attempt will fail. This option can be useful in
164 batch jobs and scripts where no user is present to enter a
171 <term><option>-W</></term>
172 <term><option>--password</></term>
175 Force <application>dropuser</application> to prompt for a
176 password before connecting to a database.
180 This option is never essential, since
181 <application>dropuser</application> will automatically prompt
182 for a password if the server demands password authentication.
183 However, <application>dropuser</application> will waste a
184 connection attempt finding out that the server wants a password.
185 In some cases it is worth typing <option>-W</> to avoid the extra
196 <title>Environment</title>
200 <term><envar>PGHOST</envar></term>
201 <term><envar>PGPORT</envar></term>
202 <term><envar>PGUSER</envar></term>
206 Default connection parameters
213 This utility, like most other <productname>PostgreSQL</> utilities,
214 also uses the environment variables supported by <application>libpq</>
215 (see <xref linkend="libpq-envars">).
222 <title>Diagnostics</title>
225 In case of difficulty, see <xref linkend="SQL-DROPROLE">
226 and <xref linkend="APP-PSQL"> for
227 discussions of potential problems and error messages.
228 The database server must be running at the
229 targeted host. Also, any default connection settings and environment
230 variables used by the <application>libpq</application> front-end
238 <title>Examples</title>
241 To remove user <literal>joe</literal> from the default database
244 <prompt>$ </prompt><userinput>dropuser joe</userinput>
249 To remove user <literal>joe</literal> using the server on host
250 <literal>eden</literal>, port 5000, with verification and a peek at the underlying
253 <prompt>$ </prompt><userinput>dropuser -p 5000 -h eden -i -e joe</userinput>
254 <computeroutput>Role "joe" will be permanently removed.
255 Are you sure? (y/n) </computeroutput><userinput>y</userinput>
256 <computeroutput>DROP ROLE joe;</computeroutput>
263 <title>See Also</title>
265 <simplelist type="inline">
266 <member><xref linkend="app-createuser"></member>
267 <member><xref linkend="sql-droprole"></member>