Letter case of "admin option" - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Letter case of "admin option"
Date
Msg-id 20220823.102921.1488629050404859334.horikyota.ntt@gmail.com
Whole thread Raw
Responses Re: Letter case of "admin option"
Re: Letter case of "admin option"
List 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

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Change pfree to accept NULL argument
Next
From: David Rowley
Date:
Subject: Re: shadow variables - pg15 edition