Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j7OE6-0008PX-Hd for pgsql-odbc@arkaria.postgresql.org; Thu, 27 Feb 2020 18:49:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j7OE5-0004Bp-5q for pgsql-odbc@arkaria.postgresql.org; Thu, 27 Feb 2020 18:49:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j7Jou-0008Q8-BA for pgsql-odbc@lists.postgresql.org; Thu, 27 Feb 2020 14:07:20 +0000 Received: from portal-smtp-out.hot.ee ([194.126.101.125]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j7Jor-0004i5-DR for pgsql-odbc@postgresql.org; Thu, 27 Feb 2020 14:07:19 +0000 Received: from localhost (localhost [127.0.0.1]) by vm-hot-relay10.estpak.ee (Postfix) with ESMTP id 5E6111CFE; Thu, 27 Feb 2020 16:07:16 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at vm-hot-relay10.estpak.ee Received: from portal-smtp-out.hot.ee ([127.0.0.1]) by localhost (vm-hot-relay10.estpak.ee [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xJxNuygjrIII; Thu, 27 Feb 2020 16:07:13 +0200 (EET) Received: from mail.hot.ee (hot-relayhost3.estpak.ee [213.180.2.81]) by vm-hot-relay10.estpak.ee (Postfix) with ESMTP id 8B67A1A96; Thu, 27 Feb 2020 16:07:13 +0200 (EET) Received: from dell2 (66-63-196-88.sta.estpak.ee [88.196.63.66]) (Authenticated sender: kobruleht2) by HOT-Relayhost3.estpak.ee (Postfix) with ESMTPSA id 48Svcc2BzWz2gL; Thu, 27 Feb 2020 16:07:11 +0200 (EET) Message-ID: <60CA3582040D4E12AE0EDCCFE78DA25B@dell2> From: "Andrus" To: "Inoue, Hiroshi" Cc: References: <00B7D82CD18C4FF2B2F462BA277CADED@dell2> <590d4cca-8af2-af01-f9b1-2bd62d466b87@dream.email.ne.jp> In-Reply-To: <590d4cca-8af2-af01-f9b1-2bd62d466b87@dream.email.ne.jp> Subject: Re: How to fix psqlODBC driver regression to get error message details Date: Thu, 27 Feb 2020 16:06:46 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_02AC_01D5ED87.E8FC14A0" X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 16.4.3528.331 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3528.331 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk See on mitmeosaline MIME-vormingus sõnum. ------=_NextPart_000_02AC_01D5ED87.E8FC14A0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! Thank you. My application uses connection strings only to provide zero = configuration application for users. How to specify this in connection string ? Andrus. From: Inoue, Hiroshi=20 Sent: Thursday, February 27, 2020 3:06 PM To: Andrus=20 Cc: pgsql-odbc@postgresql.org=20 Subject: Re: How to fix psqlODBC driver regression to get error message = details Hi Andrus, Could you please try the test drivers on Windows 12.01.0100 at https://winpg.jp/~inoue/psqlodbc/index.html ? You can turn on the *Display Optional Error Message* option using ODBC Data Source Adminirator (Advanced Options page 2). regards, Hiroshi Inoue On 2020/02/27 15:23, Andrus wrote: Hi!=20 Yes.=20 I have done this earlier for previous issue where error message was = always the same after moving to libpq and also approx 10 years ago for = another issue.=20 In pgsql odbc source code file connection.c: line 866=20 contains:=20 errprimary =3D PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);=20 which gets only primary error message.=20 To get error message detail, PG_DIAG_MESSAGE_DETAIL should used = according=20 to https://www.postgresql.org/docs/current/libpq-exec.html.=20 PG_DIAG_MESSAGE_DETAIL is not used in pgsql-odbc source code.=20 I have large number of schemas all containing same table names.=20 Error message and even error message detail show only table name = without schema name.=20 This makes difficult to diagnore errors.=20 According to docs there is parameter=20 PG_DIAG_SCHEMA_NAME=20 If the error was associated with a specific database object, the name = of the schema containing that object, if any.=20 Can you add this also to error message if this provides schema name or = error.=20 Also following fields would be useful in error message:=20 PG_DIAG_MESSAGE_HINT=20 PG_DIAG_STATEMENT_POSITION=20 PG_DIAG_INTERNAL_QUERY=20 PG_DIAG_CONTEXT=20 PG_DIAG_COLUMN_NAME=20 PG_DIAG_DATATYPE_NAME=20 Can you provide a way to get them also in error message.=20 Andrus.=20 -----Algs=C3=B5num----- From: Inoue, Hiroshi=20 Sent: Thursday, February 27, 2020 4:43 AM=20 To: Andrus=20 Cc: pgsql-odbc@postgresql.org=20 Subject: Re: How to fix psqlODBC driver regression to get error = message details=20 Hi Andrus,=20 Could you try the test driver if I provide a test driver on Windows?=20 regards,=20 Hiroshi Inoue=20 On 2020/02/23 7:43, Andrus wrote:=20 Hi!=20 I'm looking for a way to fix psqlODBC driver regression.=20 Starting at psqlODBC 09.05.0100 when psqlODBC driver uses libpq for = all=20 operations (earlier versions used libpg only for authentication) = ODBC client=20 does not show error message details.=20 For example, users got only generic error message like=20 Connectivity error: ERROR: insert or update on table "mytable" = violates=20 foreign key constraint "mytable_myfield_fkey=20 Error message details like=20 Key (myfield)=3D(mykeyvalue) is not present in table = "mymastertable".;=20 are no more returned.=20 How to detailed error message or at least only bad key value = "mykeyvalue"=20 which is returned in error message details ?=20 Some ideas:=20 1. First versions of libpq based ODBC drivers returned same error = message "no resource found" for all errors. Hiroshi has fixed it it = later versions. Maybe psqlODBC code can fixed to restore pre-libpq = behaviour.=20 2. Maybe analyzing odbc logs from pre and after 09.05.0100 drivers = may provide solution. I can provide ODBC log files.=20 3. psqlODBC allows to pass parameters to libpq from connection = string. Maybe some libpq parameter can fix this.=20 4. Maybe some Postgres query, postgres extension or direct odbc or = libpq call can used to return last error message details like Windows = API GetLastError() or Unix global errno.=20 5. Maybe it is possible to to create method which returns error = message detals from postgres log file.=20 Postgres 12.2 and latest psqlODBC driver 12.01.0000 are used.=20 psqlODBC is called from Visual FoxPro=20 Andrus.=20 Posted also in=20 = https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-r= egression-to-get-error-message-details=20 and in pgsql-general mailist list.=20 ------=_NextPart_000_02AC_01D5ED87.E8FC14A0 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hi!
 
Thank you.
My application uses connection strings only to provide zero = configuration=20 application for users.
How to specify this in connection string ?
 
Andrus.
 
From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get = error=20 message details
 
Hi=20 Andrus,

Could you please try the test drivers on Windows 12.01.0100 = at
https://winpg.jp/~ino= ue/psqlodbc/index.html
?
You=20 can turn on the *Display Optional Error Message* option
using ODBC = Data=20 Source Adminirator (Advanced Options page 2).

regards,
Hiroshi = Inoue

On 2020/02/27 15:23, Andrus = wrote:
Hi!=20

Yes.
I have done this earlier for previous issue where = error=20 message was always the same after moving to libpq and also approx 10 = years ago=20 for another issue.

In pgsql odbc source code file = connection.c: line=20 866

contains:

errprimary =3D PQresultErrorField(pgres, = PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error = message.=20

To get error message detail,  PG_DIAG_MESSAGE_DETAIL = should used=20 according
to https://= www.postgresql.org/docs/current/libpq-exec.html.=20
PG_DIAG_MESSAGE_DETAIL  is not used in pgsql-odbc source = code.=20

I have large number of schemas all containing same table = names.=20
Error message and even error message detail show only table name = without=20 schema name.
This makes difficult to diagnore errors. =

According to=20 docs there is parameter

PG_DIAG_SCHEMA_NAME

If the = error was=20 associated with a specific database object, the name of the schema = containing=20 that object, if any.

Can you add this also to error message if = this=20 provides schema name or error.

Also following fields would be = useful=20 in error message:

PG_DIAG_MESSAGE_HINT =
PG_DIAG_STATEMENT_POSITION=20
PG_DIAG_INTERNAL_QUERY
PG_DIAG_CONTEXT
PG_DIAG_COLUMN_NAME =
PG_DIAG_DATATYPE_NAME

Can you provide a way to get them = also in=20 error message.

Andrus.

-----Algs=C3=B5num----- From: = Inoue, Hiroshi=20
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: = pgsql-odbc@postgresql.org =
Subject: Re:=20 How to fix psqlODBC driver regression to get error message details =

Hi=20 Andrus,

Could you try the test driver if I provide a test = driver on=20 Windows?

regards,
Hiroshi Inoue

On 2020/02/23 = 7:43, Andrus=20 wrote:
Hi!

I'm looking for a way to fix = psqlODBC=20 driver regression.

Starting at psqlODBC 09.05.0100 when = psqlODBC=20 driver uses libpq for all
operations (earlier versions used = libpg only=20 for authentication) ODBC client
does not show error message = details.=20

For example, users got only generic error message like=20

   Connectivity error: ERROR: insert or update on = table=20 "mytable" violates
   foreign key constraint =20 "mytable_myfield_fkey

Error message details like=20

   Key (myfield)=3D(mykeyvalue) is not present in = table=20 "mymastertable".;

are no more returned.

How to = detailed=20 error message or at least only bad key value "mykeyvalue"
which = is=20 returned in error message details ?

Some ideas:

1. = First=20 versions of libpq based ODBC drivers returned same error message "no = resource found" for all errors. Hiroshi has fixed it it later = versions.=20 Maybe psqlODBC code can fixed to restore pre-libpq behaviour. =

2.=20 Maybe analyzing odbc logs from pre and after 09.05.0100 drivers may = provide=20 solution. I can provide ODBC log files.

3. psqlODBC allows = to pass=20 parameters to libpq from connection string. Maybe some libpq = parameter can=20 fix this.

4.  Maybe some Postgres query, postgres=20 extension  or direct odbc or libpq call can used to return last = error=20 message details like Windows API GetLastError() or Unix global = errno.=20

5. Maybe it is possible to to create method which returns = error=20 message detals from postgres log file.

Postgres 12.2 and = latest=20 psqlODBC driver 12.01.0000 are used.
psqlODBC is called from = Visual=20 FoxPro

Andrus.

Posted also in

https://stackoverflow.com= /questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-me= ssage-details=20

and in pgsql-general mailist list.=20


------=_NextPart_000_02AC_01D5ED87.E8FC14A0--