PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References
PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References

PostgreSQL - DROP USER



The PostgreSQL DROP USER statement is used to remove a user from the PostgreSQL database.

Syntax

The syntax of using DROP USER statement in PostgreSQL is given below:

DROP USER [IF EXISTS] user_name;

Parameters

IF EXISTS Optional. Specify it to conditionally remove a user only if it exists. If a user is removed which does not exist, it will raise an error.
user_name Required. Specify the name of the user to remove from the PostgreSQL database.

Example: Drop a user

In the example below, the DROP USER statement is used to drop a user called john in the PostgreSQL database.

DROP USER john;

Example: Drop more than one user

In the example below, two user is dropped in the PostgreSQL database. The two users are - john and marry.

DROP USER john, marry;