Re: [GENERAL] (replication) Detecting if server a slave, or a master in recovery

2011-09-12 Thread Guillaume Lelarge
On Mon, 2011-09-12 at 17:09 +1000, Toby Corkindale wrote: > On 12/09/11 16:54, Toby Corkindale wrote: > > Hi, > > What is the correct way to tell what mode a replicated Pg server is > > currently in, via a database connection? > > > > I can take a guess if it's the master or a slave by using the >

Re: [GENERAL] (replication) Detecting if server a slave, or a master in recovery

2011-09-12 Thread Toby Corkindale
On 12/09/11 17:27, Simon Riggs wrote: On Mon, Sep 12, 2011 at 8:19 AM, Toby Corkindale wrote: On 12/09/11 17:13, Simon Riggs wrote: On Mon, Sep 12, 2011 at 7:54 AM, Toby Corkindale What is the best method for determining whether you're connected to the master or slave database? SELECT pg_

Re: [GENERAL] (replication) Detecting if server a slave, or a master in recovery

2011-09-12 Thread Simon Riggs
On Mon, Sep 12, 2011 at 8:19 AM, Toby Corkindale wrote: > On 12/09/11 17:13, Simon Riggs wrote: >> >> On Mon, Sep 12, 2011 at 7:54 AM, Toby Corkindale >>> What is the best method for determining whether you're connected to the >>> master or slave database? >> >> SELECT pg_is_in_recovery(); > > > I

Re: [GENERAL] (replication) Detecting if server a slave, or a master in recovery

2011-09-12 Thread Toby Corkindale
On 12/09/11 17:13, Simon Riggs wrote: On Mon, Sep 12, 2011 at 7:54 AM, Toby Corkindale wrote: What is the correct way to tell what mode a replicated Pg server is currently in, via a database connection? I can take a guess if it's the master or a slave by using the pg_current_xlog_location()

Re: [GENERAL] (replication) Detecting if server a slave, or a master in recovery

2011-09-12 Thread Simon Riggs
On Mon, Sep 12, 2011 at 7:54 AM, Toby Corkindale wrote: > What is the correct way to tell what mode a replicated Pg server is > currently in, via a database connection? > > I can take a guess if it's the master or a slave by using the > pg_current_xlog_location() and pg_last_xlog_replay_location(

Re: [GENERAL] (replication) Detecting if server a slave, or a master in recovery

2011-09-12 Thread Toby Corkindale
On 12/09/11 16:54, Toby Corkindale wrote: Hi, What is the correct way to tell what mode a replicated Pg server is currently in, via a database connection? I can take a guess if it's the master or a slave by using the pg_current_xlog_location() and pg_last_xlog_replay_location() functions. Howev

[GENERAL] (replication) Detecting if server a slave, or a master in recovery

2011-09-11 Thread Toby Corkindale
Hi, What is the correct way to tell what mode a replicated Pg server is currently in, via a database connection? I can take a guess if it's the master or a slave by using the pg_current_xlog_location() and pg_last_xlog_replay_location() functions. However it occurs to me that a master server