Re: How to find out if the server is postgres slave ??

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to find out if the server is postgres slave ??
Date: 2012-11-02 13:17:37
Message-ID: CAPTjJmq8uHr+4Bf5u-W6S-T7nt0OrUZ0kAUOtpUD-GQX2X6jow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Nov 2, 2012 at 9:06 AM, expertalert <expertalert(at)gmail(dot)com> wrote:
>
> From command line, is there any way to find out if the server is actually a
> slave server not master ??
>
> I am writing some script, so for sanity check purpose , i need to know if
> the server the server i am on , its actually slave
>
> thanks for your help.

select pg_is_in_recovery()

If it's true, you're on a slave; if false, master.

ChrisA

In response to

Browse pgsql-general by date

  From Date Subject
Next Message dinesh kumar 2012-11-02 14:02:23 Re: Postgresql - 8.3 Replication in windows
Previous Message dinesh kumar 2012-11-02 12:33:38 Re: How to find out if the server is postgres slave ??