]> begriffs open source - ai-pg/blob - full-docs/txt/app-dropuser.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / app-dropuser.txt
1
2 dropuser
3
4    dropuser — remove a PostgreSQL user account
5
6 Synopsis
7
8    dropuser [connection-option...] [option...] [username]
9
10 Description
11
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.
16
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.
20
21 Options
22
23    dropuser accepts the following command-line arguments:
24
25    username
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.
29
30    -e
31           --echo
32           Echo the commands that dropuser generates and sends to the
33           server.
34
35    -i
36           --interactive
37           Prompt for confirmation before actually removing the user, and
38           prompt for the user name if none is specified on the command
39           line.
40
41    -V
42           --version
43           Print the dropuser version and exit.
44
45    --if-exists
46           Do not throw an error if the user does not exist. A notice is
47           issued in this case.
48
49    -?
50           --help
51           Show help about dropuser command line arguments, and exit.
52
53    dropuser also accepts the following command-line arguments for
54    connection parameters:
55
56    -h host
57           --host=host
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.
61
62    -p port
63           --port=port
64           Specifies the TCP port or local Unix domain socket file
65           extension on which the server is listening for connections.
66
67    -U username
68           --username=username
69           User name to connect as (not the user name to drop).
70
71    -w
72           --no-password
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.
78
79    -W
80           --password
81           Force dropuser to prompt for a password before connecting to a
82           database.
83
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
89           connection attempt.
90
91 Environment
92
93    PGHOST
94           PGPORT
95           PGUSER
96           Default connection parameters
97
98    PG_COLOR
99           Specifies whether to use color in diagnostic messages. Possible
100           values are always, auto and never.
101
102    This utility, like most other PostgreSQL utilities, also uses the
103    environment variables supported by libpq (see Section 32.15).
104
105 Diagnostics
106
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.
111
112 Examples
113
114    To remove user joe from the default database server:
115 $ dropuser joe
116
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
122 DROP ROLE joe;
123
124 See Also
125
126    createuser, DROP ROLE