| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Juan Backson <juanbackson(at)gmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: PQstatus does not seem to work |
| Date: | 2009-08-10 17:01:50 |
| Message-ID: | 12473.1249923710@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Juan Backson <juanbackson(at)gmail(dot)com> writes:
> I used PQstatus(conn) function to check connection status, but I found that
> it still returns CONNECTION_OK even after postgres is restarted. Does
> anyone know if there is another command that I can use to check connection
> status?
PQstatus isn't going to get updated until you try to do some operation
with the connection object. Otherwise it wouldn't be a simple inquiry
function, but some exceedingly expensive operation involving attempting
to contact the server.
> What other solution is available to check whether a connection is still
> alive?
Send a query.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sam Mason | 2009-08-10 17:08:16 | Re: PQstatus does not seem to work |
| Previous Message | David Fetter | 2009-08-10 16:57:06 | Re: Accessing a database form another database |