Fix an ALTER GROUP ... DROP USER error message.
authorNathan Bossart <[email protected]>
Thu, 9 Jan 2025 23:10:13 +0000 (17:10 -0600)
committerNathan Bossart <[email protected]>
Thu, 9 Jan 2025 23:10:13 +0000 (17:10 -0600)
commit0b5927dfac26a620b0bed53d8955e68a134db452
treec58a1747a4bfda27f3618f5939d2df714d36d8d0
parentbe7489662e7759de7a8338d3e65cd6a22dfa4976
Fix an ALTER GROUP ... DROP USER error message.

This error message stated the privileges required to add a member
to a group even if the user was trying to drop a member:

postgres=> alter group a drop user b;
ERROR:  permission denied to alter role
DETAIL:  Only roles with the ADMIN option on role "a" may add members.

Since the required privileges for both operations are the same, we
can fix this by modifying the message to mention both adding and
dropping members:

postgres=> alter group a drop user b;
ERROR:  permission denied to alter role
DETAIL:  Only roles with the ADMIN option on role "a" may add or drop members.

Author: ChangAo Chen
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/tencent_FAA0D00E3514AAF0BBB6322542A6094FEF05%40qq.com
Backpatch-through: 16
src/backend/commands/user.c
src/test/regress/expected/privileges.out
src/test/regress/sql/privileges.sql