Re: documentation fix for SET ROLE

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: "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-10 01:27:30
Message-ID: 9972F281-B8CB-4FE5-BD80-17BA09F9D791@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for reviewing.

On 3/8/21 3:49 PM, David G. Johnston wrote:
> On Mon, Mar 8, 2021 at 4:41 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>> You will want to add this to the commitfest if you haven't already.

Here is the commitfest entry: https://commitfest.postgresql.org/32/2993/

>> I would suggest adding a section titled "Identification" and placing these under that.

Good idea.

>> Reading it over it looks good. One point though: SET and SET ROLE are indeed "at run-time" (not 'run time'). ALTER ROLE and ALTER DATABASE should be considered "at connection-time" just like the command-line options.

Makes sense. I've applied these changes.

> Also, as a nearby email just reminded me, the determination of which role name is used to figure out default settings is the presented user name, not the one that would result from a connection-time role change as described here - though this should be tested, and then documented.

Yes, this seems to be correct. I've added a note about this behavior
in the patch.

-- setup
CREATE ROLE test1;
CREATE ROLE test2 WITH LOGIN IN ROLE test1;
ALTER ROLE test1 SET client_min_messages = 'error';
ALTER ROLE test2 SET client_min_messages = 'warning';
ALTER ROLE test2 SET ROLE = 'test1';

-- as test2
postgres=> SELECT CURRENT_USER, setting FROM pg_settings WHERE name = 'client_min_messages';
current_user | setting
--------------+---------
test1 | warning
(1 row)

Nathan

Attachment Content-Type Size
v3-0001-Small-documentation-fix-for-SET-ROLE.patch application/octet-stream 4.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2021-03-10 01:29:33 Re: Boundary value check in lazy_tid_reaped()
Previous Message Ajin Cherian 2021-03-10 00:58:57 Re: [HACKERS] logical decoding of two-phase transactions