Doc: explain how to test ADMIN privilege with pg_has_role().
authorTom Lane <[email protected]>
Fri, 20 Sep 2024 19:56:34 +0000 (15:56 -0400)
committerTom Lane <[email protected]>
Fri, 20 Sep 2024 19:56:34 +0000 (15:56 -0400)
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

doc/src/sgml/func.sgml

index c8e8d030457c442adbf4517ecc342b7f1bbc1015..487bb103637becefdd585d2922a2da2083cb7fe5 100644 (file)
@@ -18335,6 +18335,10 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
     the role (that is, the right to do <command>SET ROLE</command>), while
     <literal>USAGE</literal> denotes whether the privileges of the role
     are immediately available without doing <command>SET ROLE</command>.
+    <literal>WITH ADMIN OPTION</literal> or <literal>WITH GRANT
+    OPTION</literal> can be added to either of these privilege types to
+    test whether the <literal>ADMIN</literal> privilege is held (all
+    four spellings test the same thing).
    </para>
 
    <para>