Search Postgresql Archives

Re: Determine if postgresql cluster running is primary or not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

> On 20. Nov, 2020, at 10:34, David G. Johnston <david.g.johnston@xxxxxxxxx> wrote:
> 
> 
> On Friday, November 20, 2020, Paul Förster <paul.foerster@xxxxxxxxx> wrote:
> 
> > On 20. Nov, 2020, at 10:03, Thomas Kellerer <shammat@xxxxxxx> wrote:
> 
> > 
> >   select pg_is_in_recovery();
> 
> I usually don't recommend using pg_is_in_recovery() only because a database cluster can be in recovery for other reasons. This is why I always do the following:
> 
> Do any of those other reasons allow connections that could execute that function to exist?

that always depends on what your application does. An application could still select a lot of things, maybe even wrongly so, even if the cluster is in recovery mode.

That was my idea when writing this query and it's been working fine for years now.

Cheers,
Paul





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux