dropuser

A core utility for removing a database user

dropuser is a core utility for dropping (removing) a database user, and is essentially a wrapper around the DROP ROLE command.

dropuser was added in PostgreSQL 7.0.

Usage

dropuser does not emit any output on successful removal of a user.

Source code

The dropuser source code is located at src/bin/scripts/dropuser.c.

Change history

Examples

Basic usage example for dropuser:

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 admin     | Cannot login                                               | {newuser}
 newuser   |                                                            | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

postgres=# \q

postgres$ dropuser -h localhost newuser

psql (14.3)
Type "help" for help.

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of 
-----------+------------------------------------------------------------+-----------
 admin     | Cannot login                                               | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

Categories

Core utility, Users and roles

See also

DROP ROLE, DROP USER, createuser