4 dropuser — remove a PostgreSQL user account
8 dropuser [connection-option...] [option...] [username]
12 dropuser removes an existing PostgreSQL user. Superusers can use this
13 command to remove any role; otherwise, only non-superuser roles can be
14 removed, and only by a user who possesses the CREATEROLE privilege and
15 has been granted ADMIN OPTION on the target role.
17 dropuser is a wrapper around the SQL command DROP ROLE. There is no
18 effective difference between dropping users via this utility and via
19 other methods for accessing the server.
23 dropuser accepts the following command-line arguments:
26 Specifies the name of the PostgreSQL user to be removed. You
27 will be prompted for a name if none is specified on the command
28 line and the -i/--interactive option is used.
32 Echo the commands that dropuser generates and sends to the
37 Prompt for confirmation before actually removing the user, and
38 prompt for the user name if none is specified on the command
43 Print the dropuser version and exit.
46 Do not throw an error if the user does not exist. A notice is
51 Show help about dropuser command line arguments, and exit.
53 dropuser also accepts the following command-line arguments for
54 connection parameters:
58 Specifies the host name of the machine on which the server is
59 running. If the value begins with a slash, it is used as the
60 directory for the Unix domain socket.
64 Specifies the TCP port or local Unix domain socket file
65 extension on which the server is listening for connections.
69 User name to connect as (not the user name to drop).
73 Never issue a password prompt. If the server requires password
74 authentication and a password is not available by other means
75 such as a .pgpass file, the connection attempt will fail. This
76 option can be useful in batch jobs and scripts where no user is
77 present to enter a password.
81 Force dropuser to prompt for a password before connecting to a
84 This option is never essential, since dropuser will
85 automatically prompt for a password if the server demands
86 password authentication. However, dropuser will waste a
87 connection attempt finding out that the server wants a password.
88 In some cases it is worth typing -W to avoid the extra
96 Default connection parameters
99 Specifies whether to use color in diagnostic messages. Possible
100 values are always, auto and never.
102 This utility, like most other PostgreSQL utilities, also uses the
103 environment variables supported by libpq (see Section 32.15).
107 In case of difficulty, see DROP ROLE and psql for discussions of
108 potential problems and error messages. The database server must be
109 running at the targeted host. Also, any default connection settings and
110 environment variables used by the libpq front-end library will apply.
114 To remove user joe from the default database server:
117 To remove user joe using the server on host eden, port 5000, with
118 verification and a peek at the underlying command:
119 $ dropuser -p 5000 -h eden -i -e joe
120 Role "joe" will be permanently removed.
121 Are you sure? (y/n) y
126 createuser, DROP ROLE