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

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Chris Angelico <rosuav(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to check for server availability? [v9.3.1, Linux]
Date: 2012-05-18 15:41:04
Message-ID: CAOR=d=1mddCMgquZ9+vUm0bS8sA8gkMT=t1S6iezkgkym6eurw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, May 18, 2012 at 8:18 AM, Chris Angelico <rosuav(at)gmail(dot)com> wrote:
> 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.

Or send the command:

select 1;

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Aaron Burnett 2012-05-18 16:17:34 odd intermittent query hanging issue
Previous Message Mike Blackwell 2012-05-18 15:14:23 Log: Untranslatable character: no DETAIL