Letter case of "admin option"

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Letter case of "admin option"
Date: 2022-08-23 01:29:21
Message-ID: 20220823.102921.1488629050404859334.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Today, I see some error messages have been added, two of which look
somewhat inconsistent.

commands/user.c
@707:
> errmsg("must have admin option on role \"%s\" to add members",
@1971:
> errmsg("grantor must have ADMIN OPTION on \"%s\"",

A grep'ing told me that the latter above is the only outlier among 6
occurrences in total of "admin option/ADMIN OPTION".

Don't we unify them? I slightly prefer "ADMIN OPTION" but no problem
with them being in small letters. (Attached).

In passing, I met the following code in the same file.

> if (!have_createrole_privilege() &&
> !is_admin_of_role(currentUserId, roleid))
> ereport(ERROR,
> (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
> errmsg("must have admin option on role \"%s\"",
> rolename)));

The message seems a bit short that it only mentions admin option while
omitting CREATEROLE privilege. "must have CREATEROLE privilege or
admin option on role %s" might be better. Or we could say just
"insufficient privilege" or "permission denied" in the main error
message then provide "CREATEROLE privilege or admin option on role %s
is required" in DETAILS or HINTS message. The message was added by
c33d575899 along with the have_createrole_privilege() call so it is
unclear to me whether it is intentional or not.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
lower_ADMIN_OPTION.patch text/x-patch 571 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2022-08-23 01:38:40 Re: shadow variables - pg15 edition
Previous Message David Rowley 2022-08-23 01:17:10 Re: Change pfree to accept NULL argument