Re: documentation fix for SET ROLE

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: "Bossart, Nathan" <bossartn(at)amazon(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Joe Conway <mail(at)joeconway(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: documentation fix for SET ROLE
Date: 2021-03-11 14:57:58
Message-ID: 9500ddf2a9e37dd8ed0a2e2861e27df04d0599fe.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2021-03-11 15:14:49 Re: pg_amcheck contrib application
Previous Message Bharath Rupireddy 2021-03-11 14:56:05 Re: Logical Replication - improve error message while adding tables to the publication in check_publication_add_relation