DROP USER

A DDL command for removing a database role

DROP USER is a DDL command for removing a database role.

DROP USER was added in PostgreSQL 6.3; since PostgreSQL 8.1 it has been an alias for DROP ROLE.

Change history

Examples

Basic DROP USER execution:

postgres=# DROP USER foo;
DROP ROLE

Attempting to drop a role which does not exist:

postgres=# DROP USER foo;
ERROR:  role "foo" does not exist

Safely attempting to drop a role which might not exist:

postgres=# DROP USER IF EXISTS foo;
NOTICE:  role "foo" does not exist, skipping
DROP ROLE

Note thas as DROP USER is an alias for DROP ROLE, output returned for this command references roles.

For more examples see DROP ROLE.

Categories

DDL, User management

See also

DROP ROLE, CREATE USER, ALTER USER