DROPUSER(1)
π DROPUSER(1) β the "bye bestie" page π
okay so this is dropuser, from the PostgreSQL 13.23 documentation, and it's literally the manual page for yeeting a PostgreSQL user account out of existence. buckle up π
β¨ NAME β¨
dropuser β remove a PostgreSQL user account π«Ά
πΈ SYNOPSIS πΈ
dropuser [connection-option...] [option...] [username]
π¦ DESCRIPTION π¦
dropuser removes an existing PostgreSQL user. that's the whole vibe. π
but like β permission check, bestie: only superusers and users with the CREATEROLE privilege can remove PostgreSQL users. and if you wanna remove a superuser, you yourself gotta be a superuser. no cap, that's just how it is. π
dropuser is a wrapper around the SQL command DROP ROLE (DROP_ROLE(7)). and ngl, there is no effective difference between dropping users via this utility and via other methods for accessing the server. same energy, different door. πͺβ¨
π OPTIONS π
dropuser accepts the following command-line arguments:
usernameβ specifies the name of the PostgreSQL user to be removed. if you don't give a name on the command line and you did use the-i/--interactiveoption, you'll get prompted for it. π-e,--echoβ echo the commands thatdropusergenerates and sends to the server. it's giving "show your work" energy. π-i,--interactiveβ prompt for confirmation before actually removing the user, and prompt for the user name if none is specified on the command line. the "are you SURE sure" option. π-V,--versionβ print thedropuserversion and exit. slay, short and sweet.--if-existsβ do not throw an error if the user does not exist. a notice is issued in this case. so chill. so unbothered. π-?,--helpβ show help aboutdropusercommand line arguments, and exit. the icon of just being helpful. π
dropuser also accepts the following command-line arguments for connection parameters:
-hhost,--host=hostβ specifies the host name of the machine on which the server is running. plot twist: if the value begins with a slash, it is used as the directory for the Unix domain socket. π§-pport,--port=portβ specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. pick your door. πͺ-Uusername,--username=usernameβ user name to connect as (not the user name to drop). read that twice bestie, it's a trap. β οΈ-w,--no-passwordβ never issue a password prompt. if the server requires password authentication and a password is not available by other means such as a.pgpassfile, the connection attempt will fail. this option can be useful in batch jobs and scripts where no user is present to enter a password. lowkey essential for automation. π€-W,--passwordβ forcedropuserto prompt for a password before connecting to a database.
this option is never essential, since dropuser will automatically prompt for a password if the server demands password authentication. however, dropuser will waste a connection attempt finding out that the server wants a password. in some cases it is worth typing -W to avoid the extra connection attempt. efficiency queen behavior. β‘
π ENVIRONMENT π
PGHOSTPGPORTPGUSER
β default connection parameters β¨
PG_COLORβ specifies whether to use color in diagnostic messages. possible values arealways,autoandnever. aesthetics matter!! π¨
this utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 33.14). iykyk. π
π DIAGNOSTICS π
in case of difficulty, see DROP ROLE (DROP_ROLE(7)) and psql(1) 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 libpq front-end library will apply. so like, check those first before you spiral. π«Ά
π₯ EXAMPLES π₯
to remove user joe from the default database server:
$ dropuser joe
to remove user joe using the server on host eden, port 5000, with verification and a peek at the underlying command:
$ dropuser -p 5000 -h eden -i -e joe
Role "joe" will be permanently removed.
Are you sure? (y/n) y
DROP ROLE joe;
the confirmation prompt said what it said. π«‘
π SEE ALSO π
createuser(1), DROP ROLE (DROP_ROLE(7))
anyway that's the whole page bestie, go forth and drop responsibly πβ¨
PostgreSQL 13.23 Β· 2025 Β· that's the version and date, mwah, bye ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms