ALTER_GROUP(7pg16)

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

🌸 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: GRANT and REVOKE have additional options that are not available with this command, like the ability to grant and revoke ADMIN 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 GROUP does 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 πŸ’œ


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