Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rN7JQ-009Omf-P6 for pgsql-general@arkaria.postgresql.org; Tue, 09 Jan 2024 08:18:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rN7JP-00At85-VI for pgsql-general@arkaria.postgresql.org; Tue, 09 Jan 2024 08:18:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rN7JP-00At7v-Ko for pgsql-general@lists.postgresql.org; Tue, 09 Jan 2024 08:18:15 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rN7JN-000c7e-6g for pgsql-general@lists.postgresql.org; Tue, 09 Jan 2024 08:18:15 +0000 Content-Type: multipart/alternative; boundary="------------8FBGeFCE0P9hVO0lXxzlR0sG" Message-ID: <1e556c27-dfc2-30be-ff10-851645cae2a2@cloud.gatewaynet.com> Date: Tue, 9 Jan 2024 10:18:10 +0200 MIME-Version: 1.0 Subject: Re: postgresql custom variable in pg_settings table Content-Language: en-US To: pgsql-general@lists.postgresql.org References: From: Achilleas Mantzios - cloud In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------8FBGeFCE0P9hVO0lXxzlR0sG Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/9/24 09:38, Yi Sun wrote: > Hello, > > We custom set variable > > Added patroni.nodes_count = 2 in postgresql.conf > > postgres=# show patroni.nodes_count; >  patroni.nodes_count > --------------------- >  2 > (1 row) > > postgres=# select current_setting('patroni.nodes_count'); >  current_setting > ----------------- >  2 > (1 row) > > But can not select it from pg_settings, as we use pgwatch2 to monitor, > to avoid pgwatch2 script change prefer to use pg_setting not > current_setting() function, is it possible to get the custom variable > from pg_setting please? Thanks You may look into pg_file_settings : select setting from pg_file_settings  where name = 'patroni.nodes_count'; > > Best Regards > SY --------------8FBGeFCE0P9hVO0lXxzlR0sG Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

On 1/9/24 09:38, Yi Sun wrote:

Hello,

We custom set variable

Added patroni.nodes_count = 2 in postgresql.conf

postgres=# show patroni.nodes_count;
 patroni.nodes_count
---------------------
 2
(1 row)

postgres=# select current_setting('patroni.nodes_count');
 current_setting
-----------------
 2
(1 row)

But can not select it from pg_settings, as we use pgwatch2 to monitor, to avoid pgwatch2 script change prefer to use pg_setting not current_setting() function, is it possible to get the custom variable from pg_setting please? Thanks

You may look into pg_file_settings :

select setting from pg_file_settings  where name = 'patroni.nodes_count';


Best Regards
SY
--------------8FBGeFCE0P9hVO0lXxzlR0sG--