Re: alter system appending to a value

Victor Yegorov <vyegorov@gmail.com>

From: Victor Yegorov <vyegorov@gmail.com>
To: Luca Ferrari <fluca1978@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Date: 2025-04-30T12:19:01Z
Lists: pgsql-general
ср, 30 апр. 2025 г. в 14:15, Luca Ferrari <fluca1978@gmail.com>:

> as trivial as it sounds, is there a smart way to use ALTER SYSTEM to
> append to a value?
> Something like: ALTER SYSTEM shared_preloaded_libraries =
> current_setting( 'shared_preloaded_libraries' ) || ',foo';
>

I would do smth like:
SELECT format( 'ALTER SYSTEM SET shared_preload_libraries = %L;', setting )
  FROM pg_settings WHERE name = 'shared_preload_libraries' \gexec

Of course, you should add new value to the existing setting, making sure
there are no duplicates and the format is correct.

-- 
Victor Yegorov