Re: [PATCHES] default database creation with initdb

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Dave Page <dpage(at)vale-housing(dot)co(dot)uk>, Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, Magnus Hagander <mha(at)sollentuna(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] default database creation with initdb
Date: 2005-06-20 14:42:06
Message-ID: 42B6D5BE.1010703@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Andreas Pflug <pgadmin(at)pse-consulting(dot)de> writes:
>
>>Fallback is a fine idea, but this brings up another problem I'm
>>currently facing: how to identify the problem the connection has from
>>libpq? If the problem is a wrong password, we certainly don't want to
>>try again. I browsed the sources over and over, but apparently there's
>>no machine readable return code to distinguish the reason of connection
>>failure apart from examining the errormessage string.
>
>
> If it's a server-side failure it should have a SQLSTATE code. I think
> it'd be OK to look for ERRCODE_UNDEFINED_DATABASE to determine this.

SQLSTATE?
Specifically, I'm talking about

"no pg_hba.conf entry for ....", "Ident authentication failed.." (both
server sice) and "Is the server running on host ..." from libpq which I
receive from PQerrorMessage after PQconnectdb; I only receive
CONNECTION_BAD from PQstatus where I'd like it a little more specific
(maybe an PQextendedStatus)

Regards,
Andreas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-06-20 14:43:12 Re: quote_boolean() and friends missing
Previous Message Tom Lane 2005-06-20 14:39:08 Re: quote_boolean() and friends missing