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>--if-exists</></term>
95 Do not throw an error if the user does not exist. A notice is
102 <term><option>-V</></term>
103 <term><option>--version</></term>
106 Print the <application>dropuser</application> version and exit.
112 <term><option>-?</></term>
113 <term><option>--help</></term>
116 Show help about <application>dropuser</application> command line
126 <application>dropuser</application> also accepts the following
127 command-line arguments for connection parameters:
131 <term><option>-h <replaceable class="parameter">host</replaceable></></term>
132 <term><option>--host=<replaceable class="parameter">host</replaceable></></term>
135 Specifies the host name of the machine on which the
137 is running. If the value begins with a slash, it is used
138 as the directory for the Unix domain socket.
144 <term><option>-p <replaceable class="parameter">port</replaceable></></term>
145 <term><option>--port=<replaceable class="parameter">port</replaceable></></term>
148 Specifies the TCP port or local Unix domain socket file
149 extension on which the server
150 is listening for connections.
156 <term><option>-U <replaceable class="parameter">username</replaceable></></term>
157 <term><option>--username=<replaceable class="parameter">username</replaceable></></term>
160 User name to connect as (not the user name to drop).
166 <term><option>-w</></term>
167 <term><option>--no-password</></term>
170 Never issue a password prompt. If the server requires
171 password authentication and a password is not available by
172 other means such as a <filename>.pgpass</filename> file, the
173 connection attempt will fail. This option can be useful in
174 batch jobs and scripts where no user is present to enter a
181 <term><option>-W</></term>
182 <term><option>--password</></term>
185 Force <application>dropuser</application> to prompt for a
186 password before connecting to a database.
190 This option is never essential, since
191 <application>dropuser</application> will automatically prompt
192 for a password if the server demands password authentication.
193 However, <application>dropuser</application> will waste a
194 connection attempt finding out that the server wants a password.
195 In some cases it is worth typing <option>-W</> to avoid the extra
206 <title>Environment</title>
210 <term><envar>PGHOST</envar></term>
211 <term><envar>PGPORT</envar></term>
212 <term><envar>PGUSER</envar></term>
216 Default connection parameters
223 This utility, like most other <productname>PostgreSQL</> utilities,
224 also uses the environment variables supported by <application>libpq</>
225 (see <xref linkend="libpq-envars">).
232 <title>Diagnostics</title>
235 In case of difficulty, see <xref linkend="SQL-DROPROLE">
236 and <xref linkend="APP-PSQL"> for
237 discussions of potential problems and error messages.
238 The database server must be running at the
239 targeted host. Also, any default connection settings and environment
240 variables used by the <application>libpq</application> front-end
248 <title>Examples</title>
251 To remove user <literal>joe</literal> from the default database
254 <prompt>$ </prompt><userinput>dropuser joe</userinput>
259 To remove user <literal>joe</literal> using the server on host
260 <literal>eden</literal>, port 5000, with verification and a peek at the underlying
263 <prompt>$ </prompt><userinput>dropuser -p 5000 -h eden -i -e joe</userinput>
264 <computeroutput>Role "joe" will be permanently removed.
265 Are you sure? (y/n) </computeroutput><userinput>y</userinput>
266 <computeroutput>DROP ROLE joe;</computeroutput>
272 <title>See Also</title>
274 <simplelist type="inline">
275 <member><xref linkend="app-createuser"></member>
276 <member><xref linkend="sql-droprole"></member>