]> begriffs open source - ai-pg/blob - full-docs/man1/dropuser.1
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man1 / dropuser.1
1 '\" t
2 .\"     Title: dropuser
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "DROPUSER" "1" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 dropuser \- remove a PostgreSQL user account
32 .SH "SYNOPSIS"
33 .HP \w'\fBdropuser\fR\ 'u
34 \fBdropuser\fR [\fIconnection\-option\fR...] [\fIoption\fR...] [\fIusername\fR]
35 .SH "DESCRIPTION"
36 .PP
37 dropuser
38 removes an existing
39 PostgreSQL
40 user\&. Superusers can use this command to remove any role; otherwise, only non\-superuser roles can be removed, and only by a user who possesses the
41 CREATEROLE
42 privilege and has been granted
43 ADMIN OPTION
44 on the target role\&.
45 .PP
46 dropuser
47 is a wrapper around the
48 SQL
49 command
50 \fBDROP ROLE\fR\&. There is no effective difference between dropping users via this utility and via other methods for accessing the server\&.
51 .SH "OPTIONS"
52 .PP
53 dropuser
54 accepts the following command\-line arguments:
55 .PP
56 \fIusername\fR
57 .RS 4
58 Specifies the name of the
59 PostgreSQL
60 user to be removed\&. You will be prompted for a name if none is specified on the command line and the
61 \fB\-i\fR/\fB\-\-interactive\fR
62 option is used\&.
63 .RE
64 .PP
65 \fB\-e\fR
66 .br
67 \fB\-\-echo\fR
68 .RS 4
69 Echo the commands that
70 dropuser
71 generates and sends to the server\&.
72 .RE
73 .PP
74 \fB\-i\fR
75 .br
76 \fB\-\-interactive\fR
77 .RS 4
78 Prompt for confirmation before actually removing the user, and prompt for the user name if none is specified on the command line\&.
79 .RE
80 .PP
81 \fB\-V\fR
82 .br
83 \fB\-\-version\fR
84 .RS 4
85 Print the
86 dropuser
87 version and exit\&.
88 .RE
89 .PP
90 \fB\-\-if\-exists\fR
91 .RS 4
92 Do not throw an error if the user does not exist\&. A notice is issued in this case\&.
93 .RE
94 .PP
95 \fB\-?\fR
96 .br
97 \fB\-\-help\fR
98 .RS 4
99 Show help about
100 dropuser
101 command line arguments, and exit\&.
102 .RE
103 .PP
104 dropuser
105 also accepts the following command\-line arguments for connection parameters:
106 .PP
107 \fB\-h \fR\fB\fIhost\fR\fR
108 .br
109 \fB\-\-host=\fR\fB\fIhost\fR\fR
110 .RS 4
111 Specifies the host name of the machine on which the server is running\&. If the value begins with a slash, it is used as the directory for the Unix domain socket\&.
112 .RE
113 .PP
114 \fB\-p \fR\fB\fIport\fR\fR
115 .br
116 \fB\-\-port=\fR\fB\fIport\fR\fR
117 .RS 4
118 Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections\&.
119 .RE
120 .PP
121 \fB\-U \fR\fB\fIusername\fR\fR
122 .br
123 \fB\-\-username=\fR\fB\fIusername\fR\fR
124 .RS 4
125 User name to connect as (not the user name to drop)\&.
126 .RE
127 .PP
128 \fB\-w\fR
129 .br
130 \fB\-\-no\-password\fR
131 .RS 4
132 Never issue a password prompt\&. If the server requires password authentication and a password is not available by other means such as a
133 \&.pgpass
134 file, the connection attempt will fail\&. This option can be useful in batch jobs and scripts where no user is present to enter a password\&.
135 .RE
136 .PP
137 \fB\-W\fR
138 .br
139 \fB\-\-password\fR
140 .RS 4
141 Force
142 dropuser
143 to prompt for a password before connecting to a database\&.
144 .sp
145 This option is never essential, since
146 dropuser
147 will automatically prompt for a password if the server demands password authentication\&. However,
148 dropuser
149 will waste a connection attempt finding out that the server wants a password\&. In some cases it is worth typing
150 \fB\-W\fR
151 to avoid the extra connection attempt\&.
152 .RE
153 .SH "ENVIRONMENT"
154 .PP
155 \fBPGHOST\fR
156 .br
157 \fBPGPORT\fR
158 .br
159 \fBPGUSER\fR
160 .RS 4
161 Default connection parameters
162 .RE
163 .PP
164 \fBPG_COLOR\fR
165 .RS 4
166 Specifies whether to use color in diagnostic messages\&. Possible values are
167 always,
168 auto
169 and
170 never\&.
171 .RE
172 .PP
173 This utility, like most other
174 PostgreSQL
175 utilities, also uses the environment variables supported by
176 libpq
177 (see
178 Section\ \&32.15)\&.
179 .SH "DIAGNOSTICS"
180 .PP
181 In case of difficulty, see
182 DROP ROLE (\fBDROP_ROLE\fR(7))
183 and
184 \fBpsql\fR(1)
185 for discussions of potential problems and error messages\&. The database server must be running at the targeted host\&. Also, any default connection settings and environment variables used by the
186 libpq
187 front\-end library will apply\&.
188 .SH "EXAMPLES"
189 .PP
190 To remove user
191 joe
192 from the default database server:
193 .sp
194 .if n \{\
195 .RS 4
196 .\}
197 .nf
198 $ \fBdropuser joe\fR
199 .fi
200 .if n \{\
201 .RE
202 .\}
203 .PP
204 To remove user
205 joe
206 using the server on host
207 eden, port 5000, with verification and a peek at the underlying command:
208 .sp
209 .if n \{\
210 .RS 4
211 .\}
212 .nf
213 $ \fBdropuser \-p 5000 \-h eden \-i \-e joe\fR
214 Role "joe" will be permanently removed\&.
215 Are you sure? (y/n) \fBy\fR
216 DROP ROLE joe;
217 .fi
218 .if n \{\
219 .RE
220 .\}
221 .SH "SEE ALSO"
222 \fBcreateuser\fR(1), DROP ROLE (\fBDROP_ROLE\fR(7))