Postgresql 中文操作指南
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 更改用户组的属性。这是一个已过时的命令,不过出于向下兼容性考虑仍然被接受,因为组(以及用户)已被更通用的角色概念所取代。
ALTER GROUP changes the attributes of a user group. This is an obsolete command, though still accepted for backwards compatibility, because groups (and users too) have been superseded by the more general concept of roles.
前两个变量将用户添加到一个组或将其从一个组中移除。(任何角色都可以扮演“用户”或“组”的角色。)这些变量实际上相当于授予或撤销被命名为“组”的角色中的成员身份;因此执行此操作的首选方法是使用 GRANT 或 REVOKE 。请注意, GRANT 和 REVOKE 拥有此命令中不可用的其他选项,例如授予和撤销 ADMIN OPTION 的权限,以及指定授权者的权限。
The first two variants add users to a group or remove them from a group. (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. Note that GRANT and REVOKE have additional options which are not available with this command, such as the ability to grant and revoke ADMIN OPTION, and the ability to specify the grantor.
第三个变量更改组的名称。这相当于使用 ALTER ROLE 重命名角色。
The third variant changes the name of the group. This is exactly equivalent to renaming the role with ALTER ROLE.
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;
See Also
GRANT 、 REVOKE 、 ALTER ROLE