]> begriffs open source - ai-pg/blob - full-docs/src/sgml/html/app-dropuser.html
PG 18 docs from https://ftp.postgresql.org/pub/source/v18.0/postgresql-18.0-docs...
[ai-pg] / full-docs / src / sgml / html / app-dropuser.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>dropuser</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="app-dropdb.html" title="dropdb" /><link rel="next" href="app-ecpg.html" title="ecpg" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center"><span class="application">dropuser</span></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-dropdb.html" title="dropdb">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><th width="60%" align="center">PostgreSQL Client Applications</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="app-ecpg.html" title="ecpg">Next</a></td></tr></table><hr /></div><div class="refentry" id="APP-DROPUSER"><div class="titlepage"></div><a id="id-1.9.4.7.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">dropuser</span></span></h2><p>dropuser — remove a <span class="productname">PostgreSQL</span> user account</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p id="id-1.9.4.7.4.1"><code class="command">dropuser</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...] [<em class="replaceable"><code>username</code></em>]</p></div></div><div class="refsect1" id="id-1.9.4.7.5"><h2>Description</h2><p>
3    <span class="application">dropuser</span> removes an existing
4    <span class="productname">PostgreSQL</span> user.
5    Superusers can use this command to remove any role; otherwise, only
6    non-superuser roles can be removed, and only by a user who possesses
7    the <code class="literal">CREATEROLE</code> privilege and has been granted
8    <code class="literal">ADMIN OPTION</code> on the target role.
9   </p><p>
10    <span class="application">dropuser</span> is a wrapper around the
11    <acronym class="acronym">SQL</acronym> command <a class="link" href="sql-droprole.html" title="DROP ROLE"><code class="command">DROP ROLE</code></a>.
12    There is no effective difference between dropping users via
13    this utility and via other methods for accessing the server.
14   </p></div><div class="refsect1" id="id-1.9.4.7.6"><h2>Options</h2><p>
15    <span class="application">dropuser</span> accepts the following command-line arguments:
16
17     </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>username</code></em></span></dt><dd><p>
18         Specifies the name of the <span class="productname">PostgreSQL</span> user to be removed.
19         You will be prompted for a name if none is specified on the command
20         line and the <code class="option">-i</code>/<code class="option">--interactive</code> option
21         is used.
22        </p></dd><dt><span class="term"><code class="option">-e</code><br /></span><span class="term"><code class="option">--echo</code></span></dt><dd><p>
23         Echo the commands that <span class="application">dropuser</span> generates
24         and sends to the server.
25        </p></dd><dt><span class="term"><code class="option">-i</code><br /></span><span class="term"><code class="option">--interactive</code></span></dt><dd><p>
26         Prompt for confirmation before actually removing the user, and prompt
27         for the user name if none is specified on the command line.
28        </p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
29        Print the <span class="application">dropuser</span> version and exit.
30        </p></dd><dt><span class="term"><code class="option">--if-exists</code></span></dt><dd><p>
31         Do not throw an error if the user does not exist. A notice is
32         issued in this case.
33        </p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
34        Show help about <span class="application">dropuser</span> command line
35        arguments, and exit.
36        </p></dd></dl></div><p>
37   </p><p>
38    <span class="application">dropuser</span> also accepts the following
39    command-line arguments for connection parameters:
40
41    </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-h <em class="replaceable"><code>host</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>host</code></em></code></span></dt><dd><p>
42         Specifies the host name of the machine on which the
43         server
44         is running.  If the value begins with a slash, it is used
45         as the directory for the Unix domain socket.
46        </p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>
47         Specifies the TCP port or local Unix domain socket file
48         extension on which the server
49         is listening for connections.
50        </p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>
51         User name to connect as (not the user name to drop).
52        </p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p>
53         Never issue a password prompt.  If the server requires
54         password authentication and a password is not available by
55         other means such as a <code class="filename">.pgpass</code> file, the
56         connection attempt will fail.  This option can be useful in
57         batch jobs and scripts where no user is present to enter a
58         password.
59        </p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p>
60         Force <span class="application">dropuser</span> to prompt for a
61         password before connecting to a database.
62        </p><p>
63         This option is never essential, since
64         <span class="application">dropuser</span> will automatically prompt
65         for a password if the server demands password authentication.
66         However, <span class="application">dropuser</span> will waste a
67         connection attempt finding out that the server wants a password.
68         In some cases it is worth typing <code class="option">-W</code> to avoid the extra
69         connection attempt.
70        </p></dd></dl></div><p>
71   </p></div><div class="refsect1" id="id-1.9.4.7.7"><h2>Environment</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGHOST</code><br /></span><span class="term"><code class="envar">PGPORT</code><br /></span><span class="term"><code class="envar">PGUSER</code></span></dt><dd><p>
72       Default connection parameters
73      </p></dd><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
74       Specifies whether to use color in diagnostic messages. Possible values
75       are <code class="literal">always</code>, <code class="literal">auto</code> and
76       <code class="literal">never</code>.
77      </p></dd></dl></div><p>
78    This utility, like most other <span class="productname">PostgreSQL</span> utilities,
79    also uses the environment variables supported by <span class="application">libpq</span>
80    (see <a class="xref" href="libpq-envars.html" title="32.15. Environment Variables">Section 32.15</a>).
81   </p></div><div class="refsect1" id="id-1.9.4.7.8"><h2>Diagnostics</h2><p>
82    In case of difficulty, see <a class="xref" href="sql-droprole.html" title="DROP ROLE"><span class="refentrytitle">DROP ROLE</span></a>
83    and <a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a> for
84    discussions of potential problems and error messages.
85    The database server must be running at the
86    targeted host.  Also, any default connection settings and environment
87    variables used by the <span class="application">libpq</span> front-end
88    library will apply.
89   </p></div><div class="refsect1" id="id-1.9.4.7.9"><h2>Examples</h2><p>
90     To remove user <code class="literal">joe</code> from the default database
91     server:
92 </p><pre class="screen">
93 <code class="prompt">$ </code><strong class="userinput"><code>dropuser joe</code></strong>
94 </pre><p>
95    </p><p>
96     To remove user <code class="literal">joe</code> using the server on host
97     <code class="literal">eden</code>, port 5000, with verification and a peek at the underlying
98     command:
99 </p><pre class="screen">
100 <code class="prompt">$ </code><strong class="userinput"><code>dropuser -p 5000 -h eden -i -e joe</code></strong>
101 <code class="computeroutput">Role "joe" will be permanently removed.
102 Are you sure? (y/n) </code><strong class="userinput"><code>y</code></strong>
103 <code class="computeroutput">DROP ROLE joe;</code>
104 </pre></div><div class="refsect1" id="id-1.9.4.7.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="app-createuser.html" title="createuser"><span class="refentrytitle"><span class="application">createuser</span></span></a>, <a class="xref" href="sql-droprole.html" title="DROP ROLE"><span class="refentrytitle">DROP ROLE</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-dropdb.html" title="dropdb">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html" title="PostgreSQL Client Applications">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="app-ecpg.html" title="ecpg">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">dropdb</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> <span class="application">ecpg</span></td></tr></table></div></body></html>