Re: How to check for server availability? [v9.3.1, Linux]

From: Chris Angelico <rosuav(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to check for server availability? [v9.3.1, Linux]
Date: 2012-05-18 14:18:21
Message-ID: CAPTjJmrv3uTvmFYVnRAoBkkG859KKLJP2trbtzE+g1UPfnf9Pw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, May 19, 2012 at 12:09 AM, Vincenzo Romano
<vincenzo(dot)romano(at)notorand(dot)it> wrote:
> You said enough about PQstatus. So issuing a "blank" command seems to
> be a good idea. Possibly the only one.
>
> Well, a "ping" function trying to use the current "PGconn*" to ping
> the server would make a lot of sense, though.

If it helps make your code clearer, you could send the query "/* ping
*/", which would be parsed by the server as a comment. I've not
verified, but a recent thread here mentioned that /**/ comments
(unlike double-hyphen ones) get sent to the server, so you'll see it
in your logs.

ChrisA

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2012-05-18 15:07:36 Re: How to write a script to analyze and vacuum all the tables in the system catalog?Thanks.
Previous Message Vincenzo Romano 2012-05-18 14:09:37 Re: How to check for server availability? [v9.3.1, Linux]