set_config with is_local parameter true escapes transaction boundaries

From: Ruslan Talpa <ruslan(dot)talpa(at)subzero(dot)cloud>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: set_config with is_local parameter true escapes transaction boundaries
Date: 2023-01-10 08:20:08
Message-ID: 997A11B3-BC14-44FB-A505-BE7C49BE5330@subzero.cloud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

When executing set_config with the parameter ‘is_local’ set to true within a transaction, it is expected that the config value is not available after the transaction however once the config is set in any transaction, current_setting will return 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)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message wangw.fnst@fujitsu.com 2023-01-10 11:21:56 RE: Logical Replica ReorderBuffer Size Accounting Issues
Previous Message PG Bug reporting form 2023-01-10 07:45:45 BUG #17744: Fail Assert while recoverying from pg_basebackup