DROPUSER(1)

๐Ÿ“ฆ version 18.6, in opensuse-leap 16.0

๐Ÿ’… DROPUSER(1) โ€” the dropuser page, bestie edition

okay so quick vibe check: this is the dropuser manual page from the PostgreSQL 18.6 Documentation, and I'm about to make it make sense. no cap. ๐ŸŽ€


โœจ NAME โœจ

dropuser โ€” remove a PostgreSQL user account. that's it, that's the whole job. iconic honestly ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

dropuser [connection-option...] [option...] [username]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so dropuser removes an existing PostgreSQL user. lowkey straightforward, but there's โœจlayersโœจ:

  • Superusers can use this command to remove any role. like, any. full main character energy.
  • otherwise, only non-superuser roles can be removed, and only by a user who possesses the CREATEROLE privilege and has been granted ADMIN OPTION on the target role. yes, both. the audacity honestly ๐Ÿ˜ญ

and here's the tea: dropuser is literally just a wrapper around the SQL command DROP ROLE. there is no effective difference between dropping users via this utility and via other methods for accessing the server. same result, different font. periodt ๐Ÿ’…


๐Ÿ”ฅ OPTIONS ๐Ÿ”ฅ

dropuser accepts the following command-line arguments:

  • username โ€” Specifies the name of the PostgreSQL user to be removed. You will be prompted for a name if none is specified on the command line and the -i/--interactive option is used. so like, no name + no -i = it's just gonna be sad and confused, bestie.
  • -e, --echo โ€” Echo the commands that dropuser generates and sends to the server. she's showing her work ๐Ÿ’…โœจ
  • -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, we stan a cautious queen.
  • -V, --version โ€” Print the dropuser version and exit. slay, brief.
  • --if-exists โ€” Do not throw an error if the user does not exist. A notice is issued in this case. no drama, just a lil heads up ๐ŸŒธ
  • -?, --help โ€” Show help about dropuser command line arguments, and exit.

๐ŸŒˆ connection-parameter options ๐ŸŒˆ

dropuser also accepts the following command-line arguments for connection parameters:

  • -h host, --host=host โ€” 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. so like, slash = unix socket dir, otherwise = hostname. iykyk ๐Ÿงš
  • -p port, --port=port โ€” Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections.
  • -U username, --username=username โ€” User name to connect as (not the user name to drop). โš ๏ธ this one trips people up EVERY time, read it twice bestie.
  • -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 .pgpass 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. the "nobody's home to type the password" option, fr fr.
  • -W, --password โ€” Force dropuser to 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. it's giving "just tell me upfront instead of making me guess" ๐Ÿ’€


๐Ÿ’œ ENVIRONMENT ๐Ÿ’œ

  • PGHOST
  • PGPORT
  • PGUSER

Default connection parameters. the lil trio ๐ŸŽ€

  • PG_COLOR โ€” Specifies whether to use color in diagnostic messages. Possible values are always, auto and never. yes queen, customize your error messages โœจ

This utility, like most other PostgreSQL utilities, also uses the environment variables supported by libpq (see Section 32.15). so many env vars, so little time.


๐Ÿ‘‘ 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.

bestie if it's not working: is the server even up? like actually. check that first ๐Ÿ™ˆ

๐Ÿ“ 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;

not the "permanently" in all caps energy, the drama is warranted honestly ๐Ÿ˜ญ๐Ÿ’€


โญ SEE ALSO โญ

the whole "make a user / yeet a user" cinematic universe ๐Ÿซถ


and that's the page!! this was brought to you by PostgreSQL 18.6, dated 2026, and yeah the utility is literally called DROPUSER(1) โ€” the header knew it, the footer knew it, now you know it too. mwah ๐Ÿ’‹๐ŸŒˆ

๐Ÿ“ฆ where this page comes from