ALTER_GROUP(7pg14)

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

πŸ’… ALTER GROUP πŸ’…

okay so real talk β€” this is the ALTER GROUP page from the PostgreSQL 14.24 Documentation, manual ALTER GROUP(7). she's a legacy queen but she still shows up to the party πŸŽ€


✨ NAME ✨

ALTER_GROUP β€” 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 bestie, we need to talk: this command is obsolete 😭 it's still accepted for backwards compatibility, but only because groups (and users too, honestly) got superseded by the way more general concept of roles. it's giving "still on the group chat but never replies".

The first two variants add users to a group or remove them from a group. (and like β€” any role can play the part of either a "user" or a "group" for this purpose, the labels are basically vibes πŸ¦‹) 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. periodt.

The third variant changes the name of the group. This is exactly equivalent to renaming the role with ALTER ROLE. no cap, same thing.

✨ PARAMETERS ✨

  • group_name β€” the name of the group (role) to modify. that's the one getting the glow-up πŸ’…
  • user_name β€” users (roles) that are to be added to or removed from the group. heads up: the users must already exist β€” ALTER GROUP does not create or drop users, it's not a fairy godmother 🧚
  • new_name β€” the new name of the group. the rebrand ✨

✨ 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. πŸ’€ she's off-script, she's original, she's doing her own thing.

✨ SEE ALSO ✨

GRANT(7), REVOKE(7), ALTER ROLE (ALTER_ROLE(7))


okay that's the whole page, you ate that 🫢 go forth and use GRANT/REVOKE like the main character you are πŸ‘‘

PostgreSQL 14.24 Β· 2026 Β· ALTER GROUP(7) β€” mwah, that's the sign-off, ily, see u in the next manpage πŸ’–πŸŒΈ

πŸ“¦ where this page comes from