I have had a look at the patch, and while I agree that this should
be documented, I am not happy with the patch as it is.

I think we should *not* document that under "server configuration".
This is confusing and will lead people to think that a role is
a configuration parameter.  But you cannot add

   role = myrole

to "postgresql.conf".  A role is not a GUC.

I think that the place to document this is
doc/src/sgml/ref/alter_role.sgml.

The second hunk of the patch is in the right place:

--- a/doc/src/sgml/ref/set_role.sgml
+++ b/doc/src/sgml/ref/set_role.sgml
@@ -53,9 +53,13 @@ RESET ROLE
   </para>
 
   <para>
-   The <literal>NONE</literal> and <literal>RESET</literal> forms reset the 
current
-   user identifier to be the current session user identifier.
-   These forms can be executed by any user.
+   The <literal>NONE</literal> form resets the current user identifier to the
+   current session user identifier.  The <literal>RESET</literal> form resets
+   the current user identifier to the default value.  The default value can be
+   the command-line option value, the per-database default setting, or the
+   per-user default setting for the originally authenticated session user, if
+   any such settings exist.  Otherwise, the default value will be the current
+   session user identifier.  These forms can be executed by any user.
   </para>
  </refsect1>

Perhaps this could be reworded in a simpler fashion, like:

<literal>SET ROLE NONE</literal> sets the user identifier to the current
session identifier, as returned by the <function>session_user</function>
function.  <literal>RESET ROLE</literal> sets the user identifier to the
value it had after you connected to the database.  This can be different
from the session identifier if <literal>ALTER DATABASE</literal> or
<literal>ALTER ROLE</literal> were used to assign a different default role.

(I hope what I wrote is correct.)

Yours,
Laurenz Albe



Reply via email to