On 2/17/21 2:12 PM, David G. Johnston wrote:
> On Wednesday, February 17, 2021, Bossart, Nathan <bossa...@amazon.com
> <mailto:bossa...@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: signature.asc
Description: OpenPGP digital signature

Reply via email to