Re: How to get correct error message before logging to database - Mailing list pgsql-odbc

From Adrian Klaver
Subject Re: How to get correct error message before logging to database
Date
Msg-id 07661375-bd1c-c19a-e5f1-460fc9dc3376@aklaver.com
Whole thread Raw
In response to Re: How to get correct error message before logging to database  ("Andrus" <kobruleht2@hot.ee>)
Responses Re: How to get correct error message before logging to database  ("Andrus" <kobruleht2@hot.ee>)
List 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@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@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.klaver@aklaver.com


pgsql-odbc by date:

Previous
From: "Andrus"
Date:
Subject: Re: How to get correct error message before logging to database
Next
From: "Andrus"
Date:
Subject: Re: How to get correct error message before logging to database