dropuser
Removes an existing role.
Synopsis
dropuser [<connection-option> ...] [-e] [-i] <role_name>
dropuser -? | --help
dropuser -V | --version
Description
dropuser removes an existing role from Greengage DB.
Only superusers and roles with the CREATEROLE privilege can remove roles.
To remove a superuser role, you must yourself be a superuser.
dropuser is a wrapper around the SQL command DROP ROLE.
Options
- <role_name>
-
The name of the role to be removed. You will be prompted for a name if not specified on the command line and the
-i/--interactiveoption is used. - -e | --echo
-
Echo the commands that
dropusergenerates and sends to the server. - -i | --interactive
-
Prompt for confirmation before actually removing the role, and prompt for the role name if none is specified on the command line.
- --if-exists
-
Do not throw an error if the role does not exist. A notice is issued in this case.
- -V | --version
-
Print the
dropuserversion and exit. - -? | --help
-
Show help about
dropusercommand line arguments, and exit.
Connection options
- -h <host> | --host=<host>
-
The host name of the machine on which the Greengage DB master is running. If not specified, reads from the
PGHOSTenvironment variable or defaults tolocalhost. - -p <port> | --port=<port>
-
The TCP port on which the Greengage DB master is listening for connections. If not specified, reads from the
PGPORTenvironment variable or defaults to5432. - -U <username> | --username=<username>
-
The database role name to connect as. If not specified, reads from the
PGUSERenvironment variable or defaults to the current system role name. - -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.
- -W | --password
-
Force a password prompt.
Examples
-
Remove the
joerole using default connection options:$ dropuser joe -
Remove the
joerole using connection options, with verification, and echo the generated command:$ dropuser -p 5432 -h mdw -i -e joeThe prompt:
Role "joe" will be permanently removed. Are you sure? (y/n) y
The result:
SELECT pg_catalog.set_config('search_path', '', false) DROP ROLE joe;