ALTER_GROUP(7pg15)
π NAME π
okay so this is ALTER_GROUP(7pg15) β the PostgreSQL 15.19 docs page for ALTER_GROUP, and itβs literally the βchange role name or membershipβ command, bestie. Main character energy for role groups, even if sheβs a little legacy. π
β¨ SYNOPSIS β¨
the whole syntax vibe is this, exactly:
ALTER GROUP role_specification ADD USER user_name [, ... ]
ALTER GROUP role_specification DROP USER user_name [, ... ]
where role_specification can be:
role_name
| CURRENT_ROLE
| CURRENT_USER
| SESSION_USER
ALTER GROUP group_name RENAME TO new_name
πΈ DESCRIPTION πΈ
okay so ALTER GROUP changes the attributes of a user group. but bestie, real talk: this is an obsolete command, though itβs still accepted for backwards compatibility, because groups (and users too) have been superseded by the more general concept of roles. sheβs iconic but legacy, yk?
π¨ Obsolete alert: ALTER GROUP is obsolete and still accepted for backwards compatibility. Groups and users have been superseded by the more general concept of roles.
the first two variants add users to a group or remove them from a group. and yes β any role can play the part of either a βuserβ or a βgroupβ for this purpose. these variants are effectively equivalent to granting or revoking membership in the role named as the βgroupβ; so the preferred way to do this is to use GRANT or REVOKE. thatβs the slay-approved route. β¨
the third variant changes the name of the group. this is exactly equivalent to renaming the role with ALTER ROLE. same energy, different command name. π¦
π PARAMETERS π
group_nameβ the name of the group (role) to modify. thatβs the one getting the glow-up or the membership update.user_nameβ users (roles) that are to be added to or removed from the group. the users must already exist;ALTER GROUPdoes not create or drop users. no drive-by user creation, bestie. πnew_nameβ the new name of the group. fresh name, same group, periodt. π«
π¦ EXAMPLES π¦
add users to a group:
ALTER GROUP staff ADD USER karl, john;
remove a user from a group:
ALTER GROUP workers DROP USER beth;
see? lowkey simple. add the besties, remove the besties, rename the group. π
π COMPATIBILITY π
there is no ALTER GROUP statement in the SQL standard. not a single one. sheβs built different, and by different i mean PostgreSQL-specific. π
π₯ SEE ALSO π₯
go peek at GRANT(7), REVOKE(7), and ALTER ROLE (thatβs ALTER_ROLE(7)) β theyβre the ones you actually want for the modern role-membership vibe. π«Ά
okay thatβs the whole page, bestie β from PostgreSQL 15.19, dated 2026, filed under ALTER GROUP(7). mwah πβ¨
π¦ 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