DROP_ROLE(7pg14)
π DROP_ROLE π
okay so bestie, this is the DROP_ROLE page from the PostgreSQL 14.24 manual β itβs giving βremove a database roleβ energy, and weβre gonna get through it together β¨
πΈ NAME πΈ
DROP_ROLE β remove a database role. literally the whole point, no cap π
β¨ SYNOPSIS β¨
DROP ROLE [ IF EXISTS ] name [, ...]
π¦ DESCRIPTION π¦
DROP ROLE removes the specified role(s). π«Ά
to drop a superuser role, you must be a superuser yourself; to drop non-superuser roles, you must have the CREATEROLE privilege. periodt.
a role cannot be removed if it is still referenced in any database of the cluster; an error will be raised if so. π before dropping the role, you must drop all the objects it owns (or reassign their ownership) and revoke any privileges the role has been granted on other objects. the REASSIGN OWNED and DROP OWNED commands can be useful for this purpose; see Section 22.4 for more discussion.
however, it is not necessary to remove role memberships involving the role; DROP ROLE automatically revokes any memberships of the target role in other roles, and of other roles in the target role. the other roles are not dropped nor otherwise affected. iconic behavior, honestly π
π PARAMETERS π
IF EXISTSβ do not throw an error if the role does not exist. a notice is issued in this case. π«Άnameβ the name of the role to remove. π
π₯ NOTES π₯
PostgreSQL includes a program dropuser(1) that has the same functionality as this command (in fact, it calls this command) but can be run from the command shell. so yes, bestie, you can do this from the shell too π
π EXAMPLES π
to drop a role:
DROP ROLE jonathan;
β COMPATIBILITY β
the SQL standard defines DROP ROLE, but it allows only one role to be dropped at a time, and it specifies different privilege requirements than PostgreSQL uses. so thatβs a difference, bestie β iykyk π
π SEE ALSO π
CREATE ROLE(CREATE_ROLE(7))ALTER ROLE(ALTER_ROLE(7))SET ROLE(SET_ROLE(7))
mwah π this page is from PostgreSQL 14.24, dated 2026, and itβs the DROP ROLE(7) manual page. periodt. π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms