ALTER_GROUP(7pg15)

πŸ“¦ version 15.19, in opensuse-leap 16.0

πŸ’– 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 GROUP does 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