Re: Determine if postgresql cluster running is primary or not

Поиск
Список
Период
Сортировка
От Paul Förster
Тема Re: Determine if postgresql cluster running is primary or not
Дата
Msg-id 7D1914CE-4A9C-4A3B-91D2-22954ACC2452@gmail.com
обсуждение исходный текст
Ответ на Re: Determine if postgresql cluster running is primary or not  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Determine if postgresql cluster running is primary or not  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Hi David,

> On 20. Nov, 2020, at 10:34, David G. Johnston <david.g.johnston@gmail.com> wrote:
>
>
> On Friday, November 20, 2020, Paul Förster <paul.foerster@gmail.com> wrote:
>
> > On 20. Nov, 2020, at 10:03, Thomas Kellerer <shammat@gmx.net> 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
wronglyso, 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Yi Sun
Дата:
Сообщение: Re: received immediate shutdown request caused cluster failover
Следующее
От: Paul Förster
Дата:
Сообщение: Re: Determine if postgresql cluster running is primary or not