ALTER_GROUP(7pg13)
β¨ ALTER GROUP π
okay so bestie, welcome to the ALTER GROUP page from the PostgreSQL 13.23 Documentation β yes that's the manual name, don't @ me, I'm folding it in right at the top like a good hostess π
β¨ NAME β¨
ALTER GROUP β change role name or membership. that's it. that's the whole vibe. lowkey iconic, highkey obsolete, we'll get there πΈ
β¨ 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_USER
| SESSION_USER
ALTER GROUP group_name RENAME TO new_name
β¨ DESCRIPTION β¨
so ALTER GROUP changes the attributes of a user group. and here's the tea β β 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. it's giving "your older cousin still using their MySpace" energy, but we respect her π«Ά
the first two variants add users to a group or remove them from a group. and like, plot twist: 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(7) or REVOKE(7). periodt.
the third variant changes the name of the group. this is exactly equivalent to renaming the role with ALTER ROLE (ALTER_ROLE(7)). not similar, not kinda β exactly. no cap π
β¨ PARAMETERS β¨
group_nameβ the name of the group (role) to modify. like, the star of the show πuser_nameβ users (roles) that are to be added to or removed from the group. and heads up bestie: the users must already exist;ALTER GROUPdoes not create or drop users. it's not a whole nursery, it just does membership πnew_nameβ the new name of the group. glow-up name, slay π¦
β¨ 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;
look at karl and john getting into staff together β main character energy fr fr π and beth? she's out of workers. it happens. we move π
β¨ COMPATIBILITY β¨
there is no ALTER GROUP statement in the SQL standard. none. zero. the standard said "not me" π so keep that in mind if you were about to @ the committee.
β¨ SEE ALSO β¨
GRANT(7)REVOKE(7)ALTER ROLE(ALTER_ROLE(7))
ngl bestie, if you're writing new code, go hang out withGRANT/REVOKE/ALTER ROLEinstead βALTER GROUPis here for the nostalgia, not the future β¨
and that's the whole page!! made it to the end, so proud of you π₯Ή this little tour was brought to you by PostgreSQL 13.23, dated 2025, and the page is literally called ALTER GROUP(7) β see you in the next manpage, mwah πππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-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