Deletes a database user account.
DROP USER name [ CASCADE ]
You can use the
DROP USER command to drop the specified user. To drop a superuser, you must be a superuser
or have the
You cannot delete the user that is still referenced in a database of the cluster. Otherwise, an error occurs. Before dropping a user, you must drop all the objects that belong to the user or reassign their ownership, and revoke the privileges granted by the user.
However, you do not need to delete role memberships involving the user.
DROP USER automatically revokes the memberships of the target user in other roles and those
of other roles in the target user. Other roles are not dropped or affected.
In addition, if all objects owned by the user belong to a schema that is owned by
the user and has the same name as the user, you can specify a
CASCADE option. In this case, only the superuser and the name user can issue the
DROP USER name CASCADE command, and the schema and all objects in the schema are deleted.
|name||The name of the user to be deleted.|
|CASCADE||Specifies that the schema that is owned by the user and has the same name as the user is dropped when no dependencies on the user or the schema exist. All objects owned by the user in the schema are also dropped.|
Drop a user that does not own objects and is not granted privileges on other objects:
DROP USER john;
john user that is not granted privileges on the objects, and do not own objects outside
DROP USER john CASCADE;