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

Поиск
Список
Период
Сортировка
От Eugen Konkov
Тема Re: BUG #15646: Inconsistent behavior for current_setting/set_config
Дата
Msg-id 251485831.20190226144846@yandex.ru
обсуждение исходный текст
Ответ на Re: BUG #15646: Inconsistent behavior for current_setting/set_config  (Eugen Konkov <kes-kes@yandex.ru>)
Ответы Re: BUG #15646: Inconsistent behavior for current_setting/set_config  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список 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
currenttransaction. 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Eugen Konkov
Дата:
Сообщение: Re: BUG #15646: Inconsistent behavior for current_setting/set_config
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Remove Deprecated Exclusive Backup Mode