ALTER_GROUP(7pg16)
πΈ NAME πΈ
okay bestie, welcome to the ALTER GROUP(7) page from the PostgreSQL 16.15 Documentation β and the actual command is ALTER_GROUP, which does exactly this: change role name or membership. π
β¨ SYNOPSIS β¨
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 π¦
So ALTER GROUP changes the attributes of a user group. But listen β this is an obsolete command, though it's still accepted for backwards compatibility, because groups (and users too, fr fr) 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. π«Ά
bestie heads up:GRANTandREVOKEhave additional options that are not available with this command, like the ability to grant and revokeADMIN OPTION, and the ability to specify the grantor. no cap.
The third variant changes the name of the group. This is exactly equivalent to renaming the role with ALTER ROLE. slay. β¨
π PARAMETERS π
group_nameβ the name of the group (role) to modify.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.new_nameβ the new name of the group.
π 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;
β COMPATIBILITY β
There is no ALTER GROUP statement in the SQL standard. periodt. π
π SEE ALSO π
GRANT(7)REVOKE(7)ALTER ROLE(ALTER_ROLE(7))
mwah π source/version vibes: PostgreSQL 16.15 Documentation, date: 2026, manual: ALTER GROUP(7) β that's the whole page, bestie, go off. π§ββοΈ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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