Re: How to get correct error message before logging to database

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>, pgsql-odbc(at)postgresql(dot)org
Subject: Re: How to get correct error message before logging to database
Date: 2016-07-05 21:28:30
Message-ID: 07661375-bd1c-c19a-e5f1-460fc9dc3376@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

On 07/05/2016 01:42 PM, Andrus wrote:
> Hi!
>
>> That is many versions past. The only thing I can think of at the
>> moment is:
>> https://odbc.postgresql.org/docs/release.html
>> psqlODBC 09.05.0100 Release
>> Changes:
>> Use libpq for all communication with the server
>> Previously, libpq was only used for authentication. Using it for
>> all communication lets us remove a lot of duplicated code. libpq is
>> now required for building or using libpq.
>> You might try the version immediately preceding the above:
>> psqlODBC 09.03.0400
>> to see if you get the old behavior or new.
>
> 09.03.0400 returns proper error message on login with invalid server
> address:
>
> could not translate host name "xxx" to address: Unknown host
>
> AERROR() returns also sql error code.
>
> How to get proper error message in 09.05.0300 ?
> Maybe libpq does not return error messages before connection is
> established.

Well it is using libpq for authentication on 09.03.0400, which is the
part that is going to throw the errors.

Also psql, which uses libpq does this:

aklaver(at)panda:~> psql -d test -U aklaver -W -h host
Password for user aklaver:
psql: could not translate host name "host" to address: Name or service
not known

aklaver(at)panda:~> psql -d test -U aklaver -W -h localhost
Password for user aklaver:
psql: FATAL: password authentication failed for user "aklaver"
FATAL: password authentication failed for user "aklaver"

So I am thinking this not a libpq issue, but a change in error reporting
when the code was reorganized in 09.05.0100. I do not know the internals
well enough to say anything more. Hopefully someone that does can fill
in the blanks.
`

> I can post odbc log if this helps.
>
> Andrus.

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Andrus 2016-07-06 08:53:13 Re: How to get correct error message before logging to database
Previous Message Andrus 2016-07-05 20:42:54 Re: How to get correct error message before logging to database