From: | "Bossart, Nathan" <bossartn(at)amazon(dot)com> |
---|---|
To: | Joe Conway <mail(at)joeconway(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: documentation fix for SET ROLE |
Date: | 2021-02-17 20:30:46 |
Message-ID: | F274DC61-E916-44B0-A927-D7BCADF2CBEE@amazon.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2/17/21, 12:15 PM, "Joe Conway" <mail(at)joeconway(dot)com> wrote:
> On 2/17/21 2:12 PM, David G. Johnston wrote:
>> On Wednesday, February 17, 2021, Bossart, Nathan <bossartn(at)amazon(dot)com
>> <mailto:bossartn(at)amazon(dot)com>> wrote:
>>
>>
>> postgres=# ALTER ROLE test1 SET ROLE test2;
>> ALTER ROLE
>>
>>
>> I would not have expected this to work - “role” isn’t a
>> configuration_parameter. Its actually cool that it does, but this doc fix
>> should address this oversight as well.
>
>
> I was surprised this worked too.
>
> But the behavior is consistent with other GUCs. In other words, when you "ALTER
> ROLE ... SET ..." you change the default value for the session, and therefore a
> RESET just changes to that value.
Looking further, I noticed that session_authorization does not work
the same way. AFAICT this is because it's set via SetConfigOption()
in InitializeSessionUserId(). If you initialize role here, it acts
the same as session_authorization.
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 0f67b99cc5..a201bb3766 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -761,6 +761,7 @@ InitializeSessionUserId(const char *rolename, Oid roleid)
}
/* Record username and superuser status as GUC settings too */
+ SetConfigOption("role", rname, PGC_BACKEND, PGC_S_OVERRIDE);
SetConfigOption("session_authorization", rname,
PGC_BACKEND, PGC_S_OVERRIDE);
SetConfigOption("is_superuser",
Nathan
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2021-02-17 20:42:04 | Re: Finding cause of test fails on the cfbot site |
Previous Message | Andrew Dunstan | 2021-02-17 20:18:02 | Re: Finding cause of test fails on the cfbot site |