select current_setting('my.session_id');
current_setting
-----------------
14
(1 row)
select set_config ( 'my.session_id', 15::text , true) ;
set_config
------------
15
(1 row)
select current_setting('my.session_id');
current_setting
-----------------
14
(1 row)
set my.session_id = 15;
SET
select current_setting('my.session_id');
current_setting
-----------------
15
(1 row)
As seen above, SET is working, but set_config is behaving slightly differently. Probably I am missing something.
CodePudding user response:
set my.session_id = 14;
select current_setting('my.session_id');
current_setting
-----------------
14
(1 row)
select set_config ( 'my.session_id', 15::text , false) ;
set_config
------------
15
(1 row)
select current_setting('my.session_id');
current_setting
-----------------
15
(1 row)
as per manual:
Sets the parameter setting_name to new_value, and returns that value. If is_local is true, the new value will only apply during the current transaction. If you want the new value to apply for the rest of the current session, use false instead.