Re: Determine if postgresql cluster running is primary or not - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: Determine if postgresql cluster running is primary or not
Date
Msg-id f09b2f94-d9a5-473c-d726-7e1aa53a7e94@gmx.net
Whole thread Raw
In response to Determine if postgresql cluster running is primary or not  (Raul Kaubi <raulkaubi@gmail.com>)
Responses Re: Determine if postgresql cluster running is primary or not  (Paul Förster <paul.foerster@gmail.com>)
List pgsql-general
Raul Kaubi schrieb am 20.11.2020 um 09:53:
> CentOS 7
> Postgres 9 to 12
>
> For monitoring purpose, I would like that certain scripts are only run in primary server.
> So I am looking ways to universally discover if postgresql cluster that is running is primary or not.

As the standby will be in constant recovery, you can use

   select pg_is_in_recovery();




pgsql-general by date:

Previous
From: Raul Kaubi
Date:
Subject: Determine if postgresql cluster running is primary or not
Next
From: Paul Förster
Date:
Subject: Re: Determine if postgresql cluster running is primary or not