DROP USER statement

Course- PostgreSQL >

This PostgreSQL tutorial explains how to use the PostgreSQL DROP USER statement with syntax and examples.

Description

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

Syntax

The syntax for the DROP USER statement in PostgreSQL is:

DROP USER user_name;

Parameters or Arguments

user_name

The name of the user to remove from the PostgreSQL database.

Note

  • If the user that you wish to delete owns a database, be sure to drop the database first and then drop the user.

Example

Let's look at how to drop a user in PostgreSQL using the DROP USER statement.

For example:

DROP USER fastread.aitechtonic;

In this example, the DROP USER statement would drop the user called fastread.aitechtonic in the PostgreSQL database.