Re: PQconnectdb et.all.

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Postgres-Interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: PQconnectdb et.all.
Date: 2006-04-04 20:41:20
Message-ID: C0582800.27DA3%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

on 4/4/06 8:09 AM, danny(at)cs(dot)huji(dot)ac(dot)il purportedly said:

> How can I programatically figure out why PQconnectdb failed?
> The reason for this is that my daemon needs to know:
> 1- if to try and reconnect (for example, if it's timing out)
> 2- abandom, if for example it has not permition.

If your question is whether you can reliably parse the result of
PQerrorMessage and determine a course of action, I think the answer is "kind
of." My understanding is that these error messages are just a human-friendly
indicator and are subject to change. You might be able to check "errno", but
I can't say whether that will be informative (depends on what libpq does in
its depths, scoping issues, among other things).

That being said, you could try to catalog the common messages and behave
accordingly, but with the caveat that future versions may change the
messages.

Hope this helps,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message patrick keshishian 2006-04-04 22:47:48 pgsql_perl5-1.9.0 / Pg - patch for PQescapeString
Previous Message Keary Suska 2006-04-04 20:24:38 Re: Memory Usage and libpq