From: Tom Lane Date: Fri, 20 Sep 2024 19:56:34 +0000 (-0400) Subject: Doc: explain how to test ADMIN privilege with pg_has_role(). X-Git-Tag: REL_16_5~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8e16522163efce0e2d75b6e8c4413be22e637550;p=thirdparty%2Fpostgresql.git Doc: explain how to test ADMIN privilege with pg_has_role(). This has always been possible, but the syntax is a bit obscure, and our user-facing docs were not very helpful. Spell it out more clearly. Per complaint from Dominique Devienne. Back-patch to all supported branches. Discussion: https://postgr.es/m/CAFCRh-8JNEy+dV4SXFOrWca50u+d=--TO4cq=+ac1oBtfJy4AA@mail.gmail.com --- diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 00d86446aa0..847fee1684f 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -23606,6 +23606,10 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute'); are immediately available without doing SET ROLE, while SET denotes whether it is possible to change to the role using the SET ROLE command. + WITH ADMIN OPTION or WITH GRANT + OPTION can be added to any of these privilege types to + test whether the ADMIN privilege is held (all + six spellings test the same thing). This function does not allow the special case of setting user to public, because the PUBLIC pseudo-role can never be a member of real roles.