set_config with is_local parameter true escapes transaction boundaries - Mailing list pgsql-bugs

From Ruslan Talpa
Subject set_config with is_local parameter true escapes transaction boundaries
Date
Msg-id 997A11B3-BC14-44FB-A505-BE7C49BE5330@subzero.cloud
Whole thread Raw
Responses Re: set_config with is_local parameter true escapes transaction boundaries
List pgsql-bugs
When executing set_config with the parameter ‘is_local’ set to true within a transaction, it is expected that the
configvalue is not available after the transaction however once the config is set in any transaction, current_setting
willreturn an empty string instead of null 

If this is expected behaviour, it is not mentioned anywhere in the documentation.

Steps to reproduce / example


psql (13.9, server 15.1 (Debian 15.1-1.pgdg110+1))
WARNING: psql major version 13, server major version 15.
         Some psql features might not work.
Type "help" for help.

app=# select current_setting('custom.a', true), current_setting('custom.a', true) is null;
 current_setting | ?column?
-----------------+----------
                     | t
(1 row)

app=# BEGIN;
START TRANSACTION

app=*# select set_config('custom.a', 'vv', true);
 set_config
------------
 vv
(1 row)

app=*# COMMIT;
COMMIT

app=# select current_setting('custom.a', true), current_setting('custom.a', true) is null;
 current_setting | ?column?
-----------------+----------
                     | f
(1 row)




pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17744: Fail Assert while recoverying from pg_basebackup
Next
From: "wangw.fnst@fujitsu.com"
Date:
Subject: RE: Logical Replica ReorderBuffer Size Accounting Issues