ALTER_GROUP(7)

πŸ’– ALTER GROUP πŸ’–

okay so bestie, welcome to the ALTER GROUP page in the PostgreSQL 18.6 docs β€” yes, that PostgreSQL, and yes, that page number 7. this one's a lil retro, a lil vintage, a lil "we keep it around for the vibes and also for backwards compatibility" 🫢


✨ 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 πŸ¦‹

ALTER GROUP changes the attributes of a user group. big important thing though: this command is obsolete, bestie 😭 it's still accepted for backwards compatibility, but the reason it's obsolete is that groups (and users too, not just groups!) have been superseded by the more general concept of roles. so like. it works. it's just not the moment anymore.

the first two variants add users to a group or remove them from a group. and here's the cute part: any role can play the part of either a "user" or a "group" for this purpose πŸ‘‘ no gatekeeping.

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 GRANT or REVOKE, fr fr. and just so you know, GRANT and REVOKE have extra options that this command simply does not have, like:

  • the ability to grant and revoke ADMIN OPTION
  • the ability to specify the grantor

so like, ALTER GROUP is giving bare minimum and that's fine, but you deserve the full menu ✨

the third variant changes the name of the group. this is exactly equivalent to renaming the role with ALTER ROLE. same energy, different spelling πŸ’«


πŸŽ€ PARAMETERS πŸŽ€

  • group_name β€” the name of the group (role) you're modifying. 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 babysitter, it's not a matchmaker, it just adds and removes 🌸
  • 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. not a single one. it's simply not there. so if you're out here expecting standard compliance, um, no πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the page bestie 🌈 this was PostgreSQL 18.6, dated 2026, and the manual page is ALTER GROUP(7) β€” go forth and maybe just use GRANT and ALTER ROLE instead, iykyk πŸ’œβœ¨