DROP_ROLE(7pg15)
πΈ NAME πΈ
okay so bestie, this is the DROP ROLE(7) manual page from the PostgreSQL 15.19 Documentation. The command is DROP_ROLE, and its whole personality is: remove a database role. β¨
π¦ SYNOPSIS π¦
Hereβs the exact syntax vibe check β no cap, keep it character for character:
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 CREATEROLE privilege. π
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. π
π 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. π
π₯ 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. π
π SEE ALSO π
CREATE ROLE(CREATE_ROLE(7))ALTER ROLE(ALTER_ROLE(7))SET ROLE(SET_ROLE(7))
mwah π β source vibes: PostgreSQL 15.19, dated 2026. Thatβs the DROP ROLE(7) page, bestie! π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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