Thread: PQstatus is getting blocked when database sytem powered off
Hi,
In my application I need to check connection status before executing the query. I am doing it using PQstatus.
Problem is : PQstatus is getting blocked If the system on which database server is running is powered off.
If I shutdown the database using pg_ctl stop or pkill -9 postmaster in that case its returning.
Is there any other way to check the connection status in this case?
Thanks
Sk
"Sunil Khatri" <sunil@6dtech.co.in> writes: > Problem is : PQstatus is getting blocked If the system on which database server is running is powered off. Hardly likely, considering that PQstatus is just ConnStatusType PQstatus(const PGconn *conn) {if (!conn) return CONNECTION_BAD;return conn->status; } I have no doubt that a query-issuing call could get blocked if the postmaster stops responding, but not PQstatus. regards, tom lane
Thanks for your reply. You are right PQstatus is not blocking, query-issuing call is getting blocked. Is there any way for handling this blocking situation? Regards Sk ----- Original Message ----- From: "Tom Lane" <tgl@sss.pgh.pa.us> To: "Sunil Khatri" <sunil@6dtech.co.in> Cc: <pgsql-interfaces@postgresql.org> Sent: Tuesday, July 22, 2008 10:58 PM Subject: Re: [INTERFACES] PQstatus is getting blocked when database sytem powered off > "Sunil Khatri" <sunil@6dtech.co.in> writes: >> Problem is : PQstatus is getting blocked If the system on which database >> server is running is powered off. > > Hardly likely, considering that PQstatus is just > > ConnStatusType > PQstatus(const PGconn *conn) > { > if (!conn) > return CONNECTION_BAD; > return conn->status; > } > > > I have no doubt that a query-issuing call could get blocked if the > postmaster stops responding, but not PQstatus. > > regards, tom lane > > -- > Sent via pgsql-interfaces mailing list (pgsql-interfaces@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-interfaces > > > -- > No virus found in this incoming message. > Checked by AVG. > Version: 7.5.524 / Virus Database: 270.5.3/1565 - Release Date: 7/21/2008 > 6:36 PM > >