Re: documentation fix for SET ROLE - Mailing list pgsql-hackers

From Joe Conway
Subject Re: documentation fix for SET ROLE
Date
Msg-id e7e64025-0a07-fa6d-665c-1deca762d868@joeconway.com
Whole thread Raw
In response to Re: documentation fix for SET ROLE  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: documentation fix for SET ROLE
Re: documentation fix for SET ROLE
List pgsql-hackers
On 2/17/21 2:12 PM, David G. Johnston wrote:
> On Wednesday, February 17, 2021, Bossart, Nathan <bossartn@amazon.com
> <mailto:bossartn@amazon.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.

-- login as postgres
nmx=# show work_mem;
 work_mem
----------
 200MB
(1 row)

nmx=# set work_mem = '42MB';
SET
nmx=# show work_mem;
 work_mem
----------
 42MB
(1 row)

nmx=# reset work_mem;
RESET
nmx=# show work_mem;
 work_mem
----------
 200MB
(1 row)

ALTER ROLE test1 SET work_mem = '42MB';

-- login as test1
nmx=> show work_mem;
 work_mem
----------
 42MB
(1 row)

nmx=> reset work_mem;
RESET
nmx=> show work_mem;
 work_mem
----------
 42MB
(1 row)

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development


Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: POC: postgres_fdw insert batching
Next
From: Andrew Dunstan
Date:
Subject: Re: Finding cause of test fails on the cfbot site