pgsql: Fix an ALTER GROUP ... DROP USER error message.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix an ALTER GROUP ... DROP USER error message.
Date: 2025-01-09 23:13:32
Message-ID: E1tW1iW-000jfG-3C@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0b5927dfac26a620b0bed53d8955e68a134db452

Modified Files
--------------
src/backend/commands/user.c | 4 ++--
src/test/regress/expected/privileges.out | 7 +++++++
src/test/regress/sql/privileges.sql | 3 +++
3 files changed, 12 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-01-10 00:01:36 pgsql: Refactor some code related to backend statistics
Previous Message Tom Lane 2025-01-09 20:17:04 pgsql: Use @extschema:name@ notation in contrib transform modules.