Re: BUG #15646: Inconsistent behavior for current_setting/set_config

From: Eugen Konkov <kes-kes(at)yandex(dot)ru>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: BUG #15646: Inconsistent behavior for current_setting/set_config
Date: 2019-02-26 12:48:46
Message-ID: 251485831.20190226144846@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hello

Documentation has no description how 'false' value for 'is_local' parameter interact with transaction

Do I understand correct?

https://www.postgresql.org/docs/11/functions-admin.html#FUNCTIONS-ADMIN-SET
>set_config sets the parameter setting_name to new_value. If is_local is true, the new value will only apply to the current transaction. If you want the new value to apply for the current session, use false instead.

If I use 'false' then transaction will not have effect, because I set the value to session?

tucha=> select current_setting( 'my.app_period', true );
current_setting
-----------------

(1 row)

tucha=> begin;
BEGIN
tucha=> select set_config( 'my.app_period', tstzrange( '-infinity', 'infinity' )::text, false );
set_config
----------------------
[-infinity,infinity)
(1 row)

tucha=> rollback;
ROLLBACK

NOTICE: session is rolled back and session value is rolled back despite on that I did not use 'true' as parameter for local:

tucha=> select current_setting( 'my.app_period', true );
current_setting
-----------------

(1 row)

tucha=> begin;
BEGIN
tucha=> select set_config( 'my.app_period', tstzrange( '-infinity', 'infinity' )::text, false );
set_config
----------------------
[-infinity,infinity)
(1 row)

tucha=> commit;
COMMIT

When I commit then the value is applied to session:
tucha=> select current_setting( 'my.app_period', true );
current_setting
----------------------
[-infinity,infinity)
(1 row)

--
Best regards,
Eugen Konkov

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2019-02-26 13:30:37 BUG #15656: Not able to login database
Previous Message Eugen Konkov 2019-02-26 12:35:39 Re: BUG #15646: Inconsistent behavior for current_setting/set_config

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-02-26 12:54:12 Re: Remove Deprecated Exclusive Backup Mode
Previous Message Eugen Konkov 2019-02-26 12:35:39 Re: BUG #15646: Inconsistent behavior for current_setting/set_config