DROP USER v14
DROP USER — Remove a database user account.
DROP USER removes the specified user. You must be a superuser to drop a superuser. To drop non-superusers, you need the
You can't remove a user if any database of the cluster references it. Before dropping the user, you must drop all the objects it owns or reassign their ownership and revoke any privileges the user was granted.
However, you don't need to remove role memberships involving the user.
DROP USER revokes any memberships of the target user in other roles and of other roles in the target user. The other roles aren't dropped or otherwise affected.
Alternatively, if the only objects owned by the user belong in a schema that's owned by the user and has the same name as the user, you can specify the
CASCADE option. In this case, the issuer of the
DROP USER name CASCADE command must be a superuser. The named user, the schema, and all objects in the schema are deleted.
The name of the user to remove.
If specified, drops the schema owned by and with the same name as the user as long as there are no other dependencies on the user or the schema. It also drops all objects owned by the user belonging to the schema.
Drop a user account named
john that owns no objects and doesn't have privileges on any other objects:
Drop the user account
john that doesn't have privileges on any objects. The account also doesn't own any objects outside of a schema named
john that's owned by the user