Search Postgresql Archives

Re: PQstatus does not seem to work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Juan Backson <juanbackson@xxxxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux