How to fix psqlODBC driver regression to get error message details

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to fix psqlODBC driver regression to get error message details

Andrus Moor
Hi!

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.



Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Clemens Ladisch
Andrus wrote:
> Error message details like
>
>    Key (myfield)=(mykeyvalue) is not present in table "mymastertable".;
>
> are no more returned.

The problem is that psqlODBC does not call the libpq APIs that would
return this information; connection.c says:

        /*
         * The full message with details and context and everything could
         * be obtained with PQresultErrorMessage(). I think that would be
         * more user-friendly, but for now, construct a message with
         * severity and primary message, which is backwards compatible.
         */

There should be connection settings for the error verbosity and context
visibility.


Regards,
Clemens


Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Inoue, Hiroshi-2
In reply to this post by Andrus Moor
Hi Andrus,

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

regards,
Hiroshi Inoue

On 2020/02/23 7:43, Andrus wrote:

> Hi!
>
> I'm looking for a way to fix psqlODBC driver regression.
>
> Starting at psqlODBC 09.05.0100 when psqlODBC driver uses libpq for all
> operations (earlier versions used libpg only for authentication) ODBC
> client
> does not show error message details.
>
> For example, users got only generic error message like
>
>    Connectivity error: ERROR: insert or update on table "mytable"
> violates
>    foreign key constraint  "mytable_myfield_fkey
>
> Error message details like
>
>    Key (myfield)=(mykeyvalue) is not present in table "mymastertable".;
>
> are no more returned.
>
> How to detailed error message or at least only bad key value "mykeyvalue"
> which is returned in error message details ?
>
> Some ideas:
>
> 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.
>
> 2. Maybe analyzing odbc logs from pre and after 09.05.0100 drivers may
> provide solution. I can provide ODBC log files.
>
> 3. psqlODBC allows to pass parameters to libpq from connection string.
> Maybe some libpq parameter can fix this.
>
> 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.
>
> 5. Maybe it is possible to to create method which returns error
> message detals from postgres log file.
>
> Postgres 12.2 and latest psqlODBC driver 12.01.0000 are used.
> psqlODBC is called from Visual FoxPro
>
> Andrus.
>
> Posted also in
>
> https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details 
>
>
> and in pgsql-general mailist list.



Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Andrus Moor
Hi!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum-----
From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message
details

Hi Andrus,

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

regards,
Hiroshi Inoue

On 2020/02/23 7:43, Andrus wrote:

> Hi!
>
> I'm looking for a way to fix psqlODBC driver regression.
>
> Starting at psqlODBC 09.05.0100 when psqlODBC driver uses libpq for all
> operations (earlier versions used libpg only for authentication) ODBC
> client
> does not show error message details.
>
> For example, users got only generic error message like
>
>    Connectivity error: ERROR: insert or update on table "mytable" violates
>    foreign key constraint  "mytable_myfield_fkey
>
> Error message details like
>
>    Key (myfield)=(mykeyvalue) is not present in table "mymastertable".;
>
> are no more returned.
>
> How to detailed error message or at least only bad key value "mykeyvalue"
> which is returned in error message details ?
>
> Some ideas:
>
> 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.
>
> 2. Maybe analyzing odbc logs from pre and after 09.05.0100 drivers may
> provide solution. I can provide ODBC log files.
>
> 3. psqlODBC allows to pass parameters to libpq from connection string.
> Maybe some libpq parameter can fix this.
>
> 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.
>
> 5. Maybe it is possible to to create method which returns error message
> detals from postgres log file.
>
> Postgres 12.2 and latest psqlODBC driver 12.01.0000 are used.
> psqlODBC is called from Visual FoxPro
>
> Andrus.
>
> Posted also in
>
> https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details
>
> and in pgsql-general mailist list.



Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Inoue, Hiroshi-2
Hi Andrus,

Could you please try the test drivers on Windows 12.01.0100 at
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.


Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Andrus Moor
Hi!
 
Thank you.
My application uses connection strings only to provide zero configuration application for users.
How to specify this in connection string ?
 
Andrus.
 
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
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
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.


Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Inoue, Hiroshi-2
Hi,

Could you please try to add "D7=1" to your connection string?

regards,
Hiroshi Inoue

On 2020/02/27 23:06, Andrus wrote:
Hi!
 
Thank you.
My application uses connection strings only to provide zero configuration application for users.
How to specify this in connection string ?
 
Andrus.
 
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
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
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.
Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Andrus Moor
Hi!
 
Thank you.
I’m using 32 bit unicode driver.
I have installed  12.01.0000   32-drivers from msi file.
Running installer from your page fails. Installer log is below. Also it uninstalls 12.01.0000 32 bit odbc driver.
After running installer there are no odbc drivers installed.
How to install new 32 bit unicode driver ?
 
Andrus.
 
Installer log:
 
 
[1648:3760][2020-02-28T11:44:28]i001: Burn v3.11.1.2318, Windows v10.0 (Build 18362: Service Pack 0), path: C:\Users\andrus\AppData\Local\Temp\{AB6840E8-E2C9-45B6-923C-56BF8B609BC6}\.cr\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]i009: Command Line: '-burn.clean.room=C:\Users\andrus\Downloads\psqlodbc-setup.exe -burn.filehandle.attached=624 -burn.filehandle.self=632'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\andrus\Downloads\psqlodbc-setup.exe'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\andrus\Downloads\'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428.log'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleName' to value 'psqlodbc'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleManufacturer' to value 'PostgreSQL Global Development Group'
[1648:1334][2020-02-28T11:44:28]i000: Setting numeric variable 'WixStdBALanguageId' to value 1033
[1648:1334][2020-02-28T11:44:28]i000: Setting version variable 'WixBundleFileVersion' to value '12.1.100.0'
[1648:3760][2020-02-28T11:44:28]i100: Detect begin, 2 packages
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {D761D71A-AC75-4221-9C42-A8CE8981D9F3}, scope: PerMachine, version: 12.1.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {01BABE69-7F9C-4577-8ECD-D4747C928A73}, scope: PerMachine, version: 11.0.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x86.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x64.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i199: Detect complete, result: 0x0
[1648:1334][2020-02-28T11:44:33]i000: Setting numeric variable 'EulaAcceptCheckbox' to value 1
[1648:3760][2020-02-28T11:44:33]i200: Plan begin, 2 packages, action: Install
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi.log'
[1648:3760][2020-02-28T11:44:33]i052: Condition 'VersionNT64' evaluates to true.
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi.log'
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x86.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x64.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i299: Plan complete, result: 0x0
[1648:3760][2020-02-28T11:44:33]i300: Apply begin
[1648:3760][2020-02-28T11:44:33]i010: Launching elevated engine process.
[1648:3760][2020-02-28T11:44:34]i011: Launched elevated engine process.
[1648:3760][2020-02-28T11:44:34]i012: Connected to elevated engine.
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[20C4:3430][2020-02-28T11:44:34]i358: Pausing automatic updates.
[20C4:3430][2020-02-28T11:44:34]i359: Paused automatic updates.
[20C4:3430][2020-02-28T11:44:34]i360: Creating a system restore point.
[20C4:3430][2020-02-28T11:44:46]i361: Created a system restore point.
[20C4:3430][2020-02-28T11:44:46]i370: Session begin, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, options: 0x7, disable resume: No
[20C4:3430][2020-02-28T11:44:48]i000: Caching bundle from: 'C:\Users\andrus\AppData\Local\Temp\{117FA21A-25D2-4824-8818-C7D6D9371B93}\.be\psqlodbc-setup.exe' to: 'C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\psqlodbc-setup.exe'
[20C4:3430][2020-02-28T11:44:48]i320: Registering bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}, version: 12.1.100.0
[20C4:3430][2020-02-28T11:44:48]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: Active, restart initiated: No, disable resume: No
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x86.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x86.msi, moving to: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi.
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x64.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x64.msi, moving to: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi.
[20C4:3430][2020-02-28T11:44:48]i323: Registering package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, version: 12.01.0100, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:48]i301: Applying execute package: psqlodbc_x86.msi, action: Install, path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:44:51]i319: Applied execute package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:44:51]i325: Registering dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:51]i323: Registering package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, version: 12.01.0100, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:44:51]i301: Applying execute package: psqlodbc_x64.msi, action: Install, path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to install MSI package.
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[1648:3760][2020-02-28T11:45:12]i319: Applied execute package: psqlodbc_x64.msi, result: 0x80070643, restart: None
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x64.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:12]i319: Applied rollback package: psqlodbc_x64.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:12]i329: Removed package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:45:12]i351: Removing cached package: psqlodbc_x64.msi, from path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\
[20C4:3430][2020-02-28T11:45:12]i326: Removed dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x86.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:13]i319: Applied rollback package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:13]i329: Removed package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:13]i351: Removing cached package: psqlodbc_x86.msi, from path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\
[20C4:3430][2020-02-28T11:45:13]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart: None, disable resume: No
[20C4:3430][2020-02-28T11:45:13]i330: Removed bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}
[20C4:3430][2020-02-28T11:45:13]i352: Removing cached bundle: {d350bf53-a7d7-4110-a949-143967bfc13c}, from path: C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\
[20C4:3430][2020-02-28T11:45:13]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart initiated: No, disable resume: No
[1648:3760][2020-02-28T11:45:13]i399: Apply complete, result: 0x80070643, restart: None, ba requested restart:  No
 
Sent: Friday, February 28, 2020 12:51 AM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

Could you please try to add "D7=1" to your connection string?

regards,
Hiroshi Inoue

On 2020/02/27 23:06, Andrus wrote:
Hi!
 
Thank you.
My application uses connection strings only to provide zero configuration application for users.
How to specify this in connection string ?
 
Andrus.
 
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
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
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.
Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Inoue, Hiroshi-2
Hi,

On 2020/02/28 18:51, Andrus wrote:
Hi!
 
Thank you.
I’m using 32 bit unicode driver.
I have installed  12.01.0000   32-drivers from msi file.
Running installer from your page fails. Installer log is below. Also it uninstalls 12.01.0000 32 bit odbc driver.

Hmm, it's strange.

Well I put msi (zip) file instead of exe file.
Please download again.

regards,
Hiroshi Inoue

After running installer there are no odbc drivers installed.
How to install new 32 bit unicode driver ?
 
Andrus.
 
Installer log:
 
 
[1648:3760][2020-02-28T11:44:28]i001: Burn v3.11.1.2318, Windows v10.0 (Build 18362: Service Pack 0), path: C:\Users\andrus\AppData\Local\Temp\{AB6840E8-E2C9-45B6-923C-56BF8B609BC6}\.cr\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]i009: Command Line: '-burn.clean.room=C:\Users\andrus\Downloads\psqlodbc-setup.exe -burn.filehandle.attached=624 -burn.filehandle.self=632'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\andrus\Downloads\psqlodbc-setup.exe'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\andrus\Downloads\'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428.log'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleName' to value 'psqlodbc'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleManufacturer' to value 'PostgreSQL Global Development Group'
[1648:1334][2020-02-28T11:44:28]i000: Setting numeric variable 'WixStdBALanguageId' to value 1033
[1648:1334][2020-02-28T11:44:28]i000: Setting version variable 'WixBundleFileVersion' to value '12.1.100.0'
[1648:3760][2020-02-28T11:44:28]i100: Detect begin, 2 packages
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {D761D71A-AC75-4221-9C42-A8CE8981D9F3}, scope: PerMachine, version: 12.1.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {01BABE69-7F9C-4577-8ECD-D4747C928A73}, scope: PerMachine, version: 11.0.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x86.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x64.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i199: Detect complete, result: 0x0
[1648:1334][2020-02-28T11:44:33]i000: Setting numeric variable 'EulaAcceptCheckbox' to value 1
[1648:3760][2020-02-28T11:44:33]i200: Plan begin, 2 packages, action: Install
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi.log'
[1648:3760][2020-02-28T11:44:33]i052: Condition 'VersionNT64' evaluates to true.
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi.log'
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x86.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x64.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i299: Plan complete, result: 0x0
[1648:3760][2020-02-28T11:44:33]i300: Apply begin
[1648:3760][2020-02-28T11:44:33]i010: Launching elevated engine process.
[1648:3760][2020-02-28T11:44:34]i011: Launched elevated engine process.
[1648:3760][2020-02-28T11:44:34]i012: Connected to elevated engine.
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[20C4:3430][2020-02-28T11:44:34]i358: Pausing automatic updates.
[20C4:3430][2020-02-28T11:44:34]i359: Paused automatic updates.
[20C4:3430][2020-02-28T11:44:34]i360: Creating a system restore point.
[20C4:3430][2020-02-28T11:44:46]i361: Created a system restore point.
[20C4:3430][2020-02-28T11:44:46]i370: Session begin, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, options: 0x7, disable resume: No
[20C4:3430][2020-02-28T11:44:48]i000: Caching bundle from: 'C:\Users\andrus\AppData\Local\Temp\{117FA21A-25D2-4824-8818-C7D6D9371B93}\.be\psqlodbc-setup.exe' to: 'C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\psqlodbc-setup.exe'
[20C4:3430][2020-02-28T11:44:48]i320: Registering bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}, version: 12.1.100.0
[20C4:3430][2020-02-28T11:44:48]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: Active, restart initiated: No, disable resume: No
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x86.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x86.msi, moving to: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi.
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x64.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x64.msi, moving to: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi.
[20C4:3430][2020-02-28T11:44:48]i323: Registering package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, version: 12.01.0100, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:48]i301: Applying execute package: psqlodbc_x86.msi, action: Install, path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:44:51]i319: Applied execute package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:44:51]i325: Registering dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:51]i323: Registering package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, version: 12.01.0100, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:44:51]i301: Applying execute package: psqlodbc_x64.msi, action: Install, path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to install MSI package.
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[1648:3760][2020-02-28T11:45:12]i319: Applied execute package: psqlodbc_x64.msi, result: 0x80070643, restart: None
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x64.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:12]i319: Applied rollback package: psqlodbc_x64.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:12]i329: Removed package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:45:12]i351: Removing cached package: psqlodbc_x64.msi, from path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\
[20C4:3430][2020-02-28T11:45:12]i326: Removed dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x86.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:13]i319: Applied rollback package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:13]i329: Removed package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:13]i351: Removing cached package: psqlodbc_x86.msi, from path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\
[20C4:3430][2020-02-28T11:45:13]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart: None, disable resume: No
[20C4:3430][2020-02-28T11:45:13]i330: Removed bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}
[20C4:3430][2020-02-28T11:45:13]i352: Removing cached bundle: {d350bf53-a7d7-4110-a949-143967bfc13c}, from path: C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\
[20C4:3430][2020-02-28T11:45:13]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart initiated: No, disable resume: No
[1648:3760][2020-02-28T11:45:13]i399: Apply complete, result: 0x80070643, restart: None, ba requested restart:  No
 
Sent: Friday, February 28, 2020 12:51 AM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

Could you please try to add "D7=1" to your connection string?

regards,
Hiroshi Inoue

On 2020/02/27 23:06, Andrus wrote:
Hi!
 
Thank you.
My application uses connection strings only to provide zero configuration application for users.
How to specify this in connection string ?
 
Andrus.
 
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
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
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.

Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Andrus Moor
Hi!
 
Thank you.
I tried this .msi on Windows 2003 32 bit server
 
image
 
but got error
 
160/IM003
Specified driver could not be loaded due to system error  126 (PostgreSQL Unicode).
 
 
According to
 
 
I copied  msvcr100.dll file to C:\Program Files\psqlODBC\1201\bin directory :
 
image
 
but problem persists.
How to use this driver in this server ?
 
Andrus.
 
 
 
Sent: Friday, February 28, 2020 2:32 PM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

On 2020/02/28 18:51, Andrus wrote:
Hi!
 
Thank you.
I’m using 32 bit unicode driver.
I have installed  12.01.0000   32-drivers from msi file.
Running installer from your page fails. Installer log is below. Also it uninstalls 12.01.0000 32 bit odbc driver.

Hmm, it's strange.

Well I put msi (zip) file instead of exe file.
Please download again.

regards,
Hiroshi Inoue

After running installer there are no odbc drivers installed.
How to install new 32 bit unicode driver ?
 
Andrus.
 
Installer log:
 
 
[1648:3760][2020-02-28T11:44:28]i001: Burn v3.11.1.2318, Windows v10.0 (Build 18362: Service Pack 0), path: C:\Users\andrus\AppData\Local\Temp\{AB6840E8-E2C9-45B6-923C-56BF8B609BC6}\.cr\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]i009: Command Line: '-burn.clean.room=C:\Users\andrus\Downloads\psqlodbc-setup.exe -burn.filehandle.attached=624 -burn.filehandle.self=632'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\andrus\Downloads\psqlodbc-setup.exe'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\andrus\Downloads\'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428.log'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleName' to value 'psqlodbc'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleManufacturer' to value 'PostgreSQL Global Development Group'
[1648:1334][2020-02-28T11:44:28]i000: Setting numeric variable 'WixStdBALanguageId' to value 1033
[1648:1334][2020-02-28T11:44:28]i000: Setting version variable 'WixBundleFileVersion' to value '12.1.100.0'
[1648:3760][2020-02-28T11:44:28]i100: Detect begin, 2 packages
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {D761D71A-AC75-4221-9C42-A8CE8981D9F3}, scope: PerMachine, version: 12.1.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {01BABE69-7F9C-4577-8ECD-D4747C928A73}, scope: PerMachine, version: 11.0.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x86.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x64.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i199: Detect complete, result: 0x0
[1648:1334][2020-02-28T11:44:33]i000: Setting numeric variable 'EulaAcceptCheckbox' to value 1
[1648:3760][2020-02-28T11:44:33]i200: Plan begin, 2 packages, action: Install
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi.log'
[1648:3760][2020-02-28T11:44:33]i052: Condition 'VersionNT64' evaluates to true.
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi.log'
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x86.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x64.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i299: Plan complete, result: 0x0
[1648:3760][2020-02-28T11:44:33]i300: Apply begin
[1648:3760][2020-02-28T11:44:33]i010: Launching elevated engine process.
[1648:3760][2020-02-28T11:44:34]i011: Launched elevated engine process.
[1648:3760][2020-02-28T11:44:34]i012: Connected to elevated engine.
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[20C4:3430][2020-02-28T11:44:34]i358: Pausing automatic updates.
[20C4:3430][2020-02-28T11:44:34]i359: Paused automatic updates.
[20C4:3430][2020-02-28T11:44:34]i360: Creating a system restore point.
[20C4:3430][2020-02-28T11:44:46]i361: Created a system restore point.
[20C4:3430][2020-02-28T11:44:46]i370: Session begin, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, options: 0x7, disable resume: No
[20C4:3430][2020-02-28T11:44:48]i000: Caching bundle from: 'C:\Users\andrus\AppData\Local\Temp\{117FA21A-25D2-4824-8818-C7D6D9371B93}\.be\psqlodbc-setup.exe' to: 'C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\psqlodbc-setup.exe'
[20C4:3430][2020-02-28T11:44:48]i320: Registering bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}, version: 12.1.100.0
[20C4:3430][2020-02-28T11:44:48]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: Active, restart initiated: No, disable resume: No
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x86.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x86.msi, moving to: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi.
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x64.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x64.msi, moving to: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi.
[20C4:3430][2020-02-28T11:44:48]i323: Registering package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, version: 12.01.0100, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:48]i301: Applying execute package: psqlodbc_x86.msi, action: Install, path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:44:51]i319: Applied execute package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:44:51]i325: Registering dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:51]i323: Registering package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, version: 12.01.0100, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:44:51]i301: Applying execute package: psqlodbc_x64.msi, action: Install, path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to install MSI package.
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[1648:3760][2020-02-28T11:45:12]i319: Applied execute package: psqlodbc_x64.msi, result: 0x80070643, restart: None
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x64.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:12]i319: Applied rollback package: psqlodbc_x64.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:12]i329: Removed package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:45:12]i351: Removing cached package: psqlodbc_x64.msi, from path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\
[20C4:3430][2020-02-28T11:45:12]i326: Removed dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x86.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:13]i319: Applied rollback package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:13]i329: Removed package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:13]i351: Removing cached package: psqlodbc_x86.msi, from path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\
[20C4:3430][2020-02-28T11:45:13]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart: None, disable resume: No
[20C4:3430][2020-02-28T11:45:13]i330: Removed bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}
[20C4:3430][2020-02-28T11:45:13]i352: Removing cached bundle: {d350bf53-a7d7-4110-a949-143967bfc13c}, from path: C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\
[20C4:3430][2020-02-28T11:45:13]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart initiated: No, disable resume: No
[1648:3760][2020-02-28T11:45:13]i399: Apply complete, result: 0x80070643, restart: None, ba requested restart:  No
 
Sent: Friday, February 28, 2020 12:51 AM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

Could you please try to add "D7=1" to your connection string?

regards,
Hiroshi Inoue

On 2020/02/27 23:06, Andrus wrote:
Hi!
 
Thank you.
My application uses connection strings only to provide zero configuration application for users.
How to specify this in connection string ?
 
Andrus.
 
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
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
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.

Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Inoue, Hiroshi-2
Hi Andrus,

Windows 2003 is too old for the current driver to work.

Could you please try the test drivers on Windows for old OSs 12.01.0100 at ?
I can't test it myself unfortunately.

regards,
Hiroshi Inoue

On 2020/03/22 23:30, Andrus wrote:
Hi!
 
Thank you.
I tried this .msi on Windows 2003 32 bit server
 
image
 
but got error
 
160/IM003
Specified driver could not be loaded due to system error  126 (PostgreSQL Unicode).
 
 
According to
 
 
I copied  msvcr100.dll file to C:\Program Files\psqlODBC\1201\bin directory :
 
image
 
but problem persists.
How to use this driver in this server ?
 
Andrus.
 
 
 
Sent: Friday, February 28, 2020 2:32 PM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

On 2020/02/28 18:51, Andrus wrote:
Hi!
 
Thank you.
I’m using 32 bit unicode driver.
I have installed  12.01.0000   32-drivers from msi file.
Running installer from your page fails. Installer log is below. Also it uninstalls 12.01.0000 32 bit odbc driver.

Hmm, it's strange.

Well I put msi (zip) file instead of exe file.
Please download again.

regards,
Hiroshi Inoue

After running installer there are no odbc drivers installed.
How to install new 32 bit unicode driver ?
 
Andrus.
 
Installer log:
 
 
[1648:3760][2020-02-28T11:44:28]i001: Burn v3.11.1.2318, Windows v10.0 (Build 18362: Service Pack 0), path: C:\Users\andrus\AppData\Local\Temp\{AB6840E8-E2C9-45B6-923C-56BF8B609BC6}\.cr\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]i009: Command Line: '-burn.clean.room=C:\Users\andrus\Downloads\psqlodbc-setup.exe -burn.filehandle.attached=624 -burn.filehandle.self=632'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\andrus\Downloads\psqlodbc-setup.exe'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\andrus\Downloads\'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428.log'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleName' to value 'psqlodbc'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleManufacturer' to value 'PostgreSQL Global Development Group'
[1648:1334][2020-02-28T11:44:28]i000: Setting numeric variable 'WixStdBALanguageId' to value 1033
[1648:1334][2020-02-28T11:44:28]i000: Setting version variable 'WixBundleFileVersion' to value '12.1.100.0'
[1648:3760][2020-02-28T11:44:28]i100: Detect begin, 2 packages
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {D761D71A-AC75-4221-9C42-A8CE8981D9F3}, scope: PerMachine, version: 12.1.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {01BABE69-7F9C-4577-8ECD-D4747C928A73}, scope: PerMachine, version: 11.0.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x86.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x64.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i199: Detect complete, result: 0x0
[1648:1334][2020-02-28T11:44:33]i000: Setting numeric variable 'EulaAcceptCheckbox' to value 1
[1648:3760][2020-02-28T11:44:33]i200: Plan begin, 2 packages, action: Install
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi.log'
[1648:3760][2020-02-28T11:44:33]i052: Condition 'VersionNT64' evaluates to true.
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi.log'
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x86.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x64.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i299: Plan complete, result: 0x0
[1648:3760][2020-02-28T11:44:33]i300: Apply begin
[1648:3760][2020-02-28T11:44:33]i010: Launching elevated engine process.
[1648:3760][2020-02-28T11:44:34]i011: Launched elevated engine process.
[1648:3760][2020-02-28T11:44:34]i012: Connected to elevated engine.
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[20C4:3430][2020-02-28T11:44:34]i358: Pausing automatic updates.
[20C4:3430][2020-02-28T11:44:34]i359: Paused automatic updates.
[20C4:3430][2020-02-28T11:44:34]i360: Creating a system restore point.
[20C4:3430][2020-02-28T11:44:46]i361: Created a system restore point.
[20C4:3430][2020-02-28T11:44:46]i370: Session begin, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, options: 0x7, disable resume: No
[20C4:3430][2020-02-28T11:44:48]i000: Caching bundle from: 'C:\Users\andrus\AppData\Local\Temp\{117FA21A-25D2-4824-8818-C7D6D9371B93}\.be\psqlodbc-setup.exe' to: 'C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\psqlodbc-setup.exe'
[20C4:3430][2020-02-28T11:44:48]i320: Registering bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}, version: 12.1.100.0
[20C4:3430][2020-02-28T11:44:48]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: Active, restart initiated: No, disable resume: No
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x86.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x86.msi, moving to: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi.
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x64.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x64.msi, moving to: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi.
[20C4:3430][2020-02-28T11:44:48]i323: Registering package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, version: 12.01.0100, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:48]i301: Applying execute package: psqlodbc_x86.msi, action: Install, path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:44:51]i319: Applied execute package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:44:51]i325: Registering dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:51]i323: Registering package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, version: 12.01.0100, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:44:51]i301: Applying execute package: psqlodbc_x64.msi, action: Install, path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to install MSI package.
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[1648:3760][2020-02-28T11:45:12]i319: Applied execute package: psqlodbc_x64.msi, result: 0x80070643, restart: None
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x64.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:12]i319: Applied rollback package: psqlodbc_x64.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:12]i329: Removed package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:45:12]i351: Removing cached package: psqlodbc_x64.msi, from path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\
[20C4:3430][2020-02-28T11:45:12]i326: Removed dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x86.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:13]i319: Applied rollback package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:13]i329: Removed package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:13]i351: Removing cached package: psqlodbc_x86.msi, from path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\
[20C4:3430][2020-02-28T11:45:13]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart: None, disable resume: No
[20C4:3430][2020-02-28T11:45:13]i330: Removed bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}
[20C4:3430][2020-02-28T11:45:13]i352: Removing cached bundle: {d350bf53-a7d7-4110-a949-143967bfc13c}, from path: C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\
[20C4:3430][2020-02-28T11:45:13]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart initiated: No, disable resume: No
[1648:3760][2020-02-28T11:45:13]i399: Apply complete, result: 0x80070643, restart: None, ba requested restart:  No
 
Sent: Friday, February 28, 2020 12:51 AM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

Could you please try to add "D7=1" to your connection string?

regards,
Hiroshi Inoue

On 2020/02/27 23:06, Andrus wrote:
Hi!
 
Thank you.
My application uses connection strings only to provide zero configuration application for users.
How to specify this in connection string ?
 
Andrus.
 
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
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
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.


Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Andrus Moor
Hi!
 
Thank you.
I tried but error is the same.
 
image
 
Old version,
 
psqlodbc_09_00_0101.msi  works.
 
Andrus.
 
 
Sent: Wednesday, March 25, 2020 2:57 AM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi Andrus,

Windows 2003 is too old for the current driver to work.

Could you please try the test drivers on Windows for old OSs 12.01.0100 at ?
I can't test it myself unfortunately.

regards,
Hiroshi Inoue

On 2020/03/22 23:30, Andrus wrote:
Hi!
 
Thank you.
I tried this .msi on Windows 2003 32 bit server
 
image
 
but got error
 
160/IM003
Specified driver could not be loaded due to system error  126 (PostgreSQL Unicode).
 
 
According to
 
 
I copied  msvcr100.dll file to C:\Program Files\psqlODBC\1201\bin directory :
 
image
 
but problem persists.
How to use this driver in this server ?
 
Andrus.
 
 
 
Sent: Friday, February 28, 2020 2:32 PM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

On 2020/02/28 18:51, Andrus wrote:
Hi!
 
Thank you.
I’m using 32 bit unicode driver.
I have installed  12.01.0000   32-drivers from msi file.
Running installer from your page fails. Installer log is below. Also it uninstalls 12.01.0000 32 bit odbc driver.

Hmm, it's strange.

Well I put msi (zip) file instead of exe file.
Please download again.

regards,
Hiroshi Inoue

After running installer there are no odbc drivers installed.
How to install new 32 bit unicode driver ?
 
Andrus.
 
Installer log:
 
 
[1648:3760][2020-02-28T11:44:28]i001: Burn v3.11.1.2318, Windows v10.0 (Build 18362: Service Pack 0), path: C:\Users\andrus\AppData\Local\Temp\{AB6840E8-E2C9-45B6-923C-56BF8B609BC6}\.cr\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]i009: Command Line: '-burn.clean.room=C:\Users\andrus\Downloads\psqlodbc-setup.exe -burn.filehandle.attached=624 -burn.filehandle.self=632'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\andrus\Downloads\psqlodbc-setup.exe'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\andrus\Downloads\'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428.log'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleName' to value 'psqlodbc'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleManufacturer' to value 'PostgreSQL Global Development Group'
[1648:1334][2020-02-28T11:44:28]i000: Setting numeric variable 'WixStdBALanguageId' to value 1033
[1648:1334][2020-02-28T11:44:28]i000: Setting version variable 'WixBundleFileVersion' to value '12.1.100.0'
[1648:3760][2020-02-28T11:44:28]i100: Detect begin, 2 packages
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {D761D71A-AC75-4221-9C42-A8CE8981D9F3}, scope: PerMachine, version: 12.1.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {01BABE69-7F9C-4577-8ECD-D4747C928A73}, scope: PerMachine, version: 11.0.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x86.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x64.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i199: Detect complete, result: 0x0
[1648:1334][2020-02-28T11:44:33]i000: Setting numeric variable 'EulaAcceptCheckbox' to value 1
[1648:3760][2020-02-28T11:44:33]i200: Plan begin, 2 packages, action: Install
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi.log'
[1648:3760][2020-02-28T11:44:33]i052: Condition 'VersionNT64' evaluates to true.
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi.log'
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x86.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x64.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i299: Plan complete, result: 0x0
[1648:3760][2020-02-28T11:44:33]i300: Apply begin
[1648:3760][2020-02-28T11:44:33]i010: Launching elevated engine process.
[1648:3760][2020-02-28T11:44:34]i011: Launched elevated engine process.
[1648:3760][2020-02-28T11:44:34]i012: Connected to elevated engine.
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[20C4:3430][2020-02-28T11:44:34]i358: Pausing automatic updates.
[20C4:3430][2020-02-28T11:44:34]i359: Paused automatic updates.
[20C4:3430][2020-02-28T11:44:34]i360: Creating a system restore point.
[20C4:3430][2020-02-28T11:44:46]i361: Created a system restore point.
[20C4:3430][2020-02-28T11:44:46]i370: Session begin, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, options: 0x7, disable resume: No
[20C4:3430][2020-02-28T11:44:48]i000: Caching bundle from: 'C:\Users\andrus\AppData\Local\Temp\{117FA21A-25D2-4824-8818-C7D6D9371B93}\.be\psqlodbc-setup.exe' to: 'C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\psqlodbc-setup.exe'
[20C4:3430][2020-02-28T11:44:48]i320: Registering bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}, version: 12.1.100.0
[20C4:3430][2020-02-28T11:44:48]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: Active, restart initiated: No, disable resume: No
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x86.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x86.msi, moving to: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi.
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x64.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x64.msi, moving to: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi.
[20C4:3430][2020-02-28T11:44:48]i323: Registering package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, version: 12.01.0100, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:48]i301: Applying execute package: psqlodbc_x86.msi, action: Install, path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:44:51]i319: Applied execute package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:44:51]i325: Registering dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:51]i323: Registering package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, version: 12.01.0100, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:44:51]i301: Applying execute package: psqlodbc_x64.msi, action: Install, path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to install MSI package.
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[1648:3760][2020-02-28T11:45:12]i319: Applied execute package: psqlodbc_x64.msi, result: 0x80070643, restart: None
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x64.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:12]i319: Applied rollback package: psqlodbc_x64.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:12]i329: Removed package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:45:12]i351: Removing cached package: psqlodbc_x64.msi, from path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\
[20C4:3430][2020-02-28T11:45:12]i326: Removed dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x86.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:13]i319: Applied rollback package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:13]i329: Removed package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:13]i351: Removing cached package: psqlodbc_x86.msi, from path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\
[20C4:3430][2020-02-28T11:45:13]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart: None, disable resume: No
[20C4:3430][2020-02-28T11:45:13]i330: Removed bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}
[20C4:3430][2020-02-28T11:45:13]i352: Removing cached bundle: {d350bf53-a7d7-4110-a949-143967bfc13c}, from path: C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\
[20C4:3430][2020-02-28T11:45:13]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart initiated: No, disable resume: No
[1648:3760][2020-02-28T11:45:13]i399: Apply complete, result: 0x80070643, restart: None, ba requested restart:  No
 
Sent: Friday, February 28, 2020 12:51 AM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

Could you please try to add "D7=1" to your connection string?

regards,
Hiroshi Inoue

On 2020/02/27 23:06, Andrus wrote:
Hi!
 
Thank you.
My application uses connection strings only to provide zero configuration application for users.
How to specify this in connection string ?
 
Andrus.
 
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
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
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.


Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Inoue, Hiroshi-2
Hi,

On 2020/03/25 21:05, Andrus wrote:
Hi!
 
Thank you.
I tried but error is the same.

Hmm, does bcrypt.dll exist in the machine?

Anyway please retry the test drivers on Windows for old OSs 12.01.0101 at .

regards,
Hiroshi Inoue

 
image
 
Old version,
 
psqlodbc_09_00_0101.msi  works.
 
Andrus.
 
 
Sent: Wednesday, March 25, 2020 2:57 AM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi Andrus,

Windows 2003 is too old for the current driver to work.

Could you please try the test drivers on Windows for old OSs 12.01.0100 at ?
I can't test it myself unfortunately.

regards,
Hiroshi Inoue

On 2020/03/22 23:30, Andrus wrote:
Hi!
 
Thank you.
I tried this .msi on Windows 2003 32 bit server
 
image
 
but got error
 
160/IM003
Specified driver could not be loaded due to system error  126 (PostgreSQL Unicode).
 
 
According to
 
 
I copied  msvcr100.dll file to C:\Program Files\psqlODBC\1201\bin directory :
 
image
 
but problem persists.
How to use this driver in this server ?
 
Andrus.
 
 
 
Sent: Friday, February 28, 2020 2:32 PM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

On 2020/02/28 18:51, Andrus wrote:
Hi!
 
Thank you.
I’m using 32 bit unicode driver.
I have installed  12.01.0000   32-drivers from msi file.
Running installer from your page fails. Installer log is below. Also it uninstalls 12.01.0000 32 bit odbc driver.

Hmm, it's strange.

Well I put msi (zip) file instead of exe file.
Please download again.

regards,
Hiroshi Inoue

After running installer there are no odbc drivers installed.
How to install new 32 bit unicode driver ?
 
Andrus.
 
Installer log:
 
 
[1648:3760][2020-02-28T11:44:28]i001: Burn v3.11.1.2318, Windows v10.0 (Build 18362: Service Pack 0), path: C:\Users\andrus\AppData\Local\Temp\{AB6840E8-E2C9-45B6-923C-56BF8B609BC6}\.cr\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]i009: Command Line: '-burn.clean.room=C:\Users\andrus\Downloads\psqlodbc-setup.exe -burn.filehandle.attached=624 -burn.filehandle.self=632'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\andrus\Downloads\psqlodbc-setup.exe'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\andrus\Downloads\'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428.log'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleName' to value 'psqlodbc'
[1648:3760][2020-02-28T11:44:28]i000: Setting string variable 'WixBundleManufacturer' to value 'PostgreSQL Global Development Group'
[1648:1334][2020-02-28T11:44:28]i000: Setting numeric variable 'WixStdBALanguageId' to value 1033
[1648:1334][2020-02-28T11:44:28]i000: Setting version variable 'WixBundleFileVersion' to value '12.1.100.0'
[1648:3760][2020-02-28T11:44:28]i100: Detect begin, 2 packages
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[1648:3760][2020-02-28T11:44:28]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {D761D71A-AC75-4221-9C42-A8CE8981D9F3}, scope: PerMachine, version: 12.1.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i103: Detected related package: {01BABE69-7F9C-4577-8ECD-D4747C928A73}, scope: PerMachine, version: 11.0.0.0, language: 0 operation: MajorUpgrade
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x86.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i101: Detected package: psqlodbc_x64.msi, state: Absent, cached: None
[1648:3760][2020-02-28T11:44:28]i199: Detect complete, result: 0x0
[1648:1334][2020-02-28T11:44:33]i000: Setting numeric variable 'EulaAcceptCheckbox' to value 1
[1648:3760][2020-02-28T11:44:33]i200: Plan begin, 2 packages, action: Install
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x86.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_000_psqlodbc_x86.msi.log'
[1648:3760][2020-02-28T11:44:33]i052: Condition 'VersionNT64' evaluates to true.
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleRollbackLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi_rollback.log'
[1648:3760][2020-02-28T11:44:33]i000: Setting string variable 'WixBundleLog_psqlodbc_x64.msi' to value 'C:\Users\andrus\AppData\Local\Temp\psqlodbc_20200228114428_001_psqlodbc_x64.msi.log'
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x86.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i201: Planned package: psqlodbc_x64.msi, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No, dependency: Register
[1648:3760][2020-02-28T11:44:33]i299: Plan complete, result: 0x0
[1648:3760][2020-02-28T11:44:33]i300: Apply begin
[1648:3760][2020-02-28T11:44:33]i010: Launching elevated engine process.
[1648:3760][2020-02-28T11:44:34]i011: Launched elevated engine process.
[1648:3760][2020-02-28T11:44:34]i012: Connected to elevated engine.
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to get size of pseudo bundle: C:\ProgramData\Package Cache\{c0188725-1628-43f1-8917-29bfb96c569e}\psqlodbc-setup.exe
[20C4:3430][2020-02-28T11:44:34]e000: Error 0x80070003: Failed to initialize package from related bundle id: {c0188725-1628-43f1-8917-29bfb96c569e}
[20C4:3430][2020-02-28T11:44:34]i358: Pausing automatic updates.
[20C4:3430][2020-02-28T11:44:34]i359: Paused automatic updates.
[20C4:3430][2020-02-28T11:44:34]i360: Creating a system restore point.
[20C4:3430][2020-02-28T11:44:46]i361: Created a system restore point.
[20C4:3430][2020-02-28T11:44:46]i370: Session begin, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, options: 0x7, disable resume: No
[20C4:3430][2020-02-28T11:44:48]i000: Caching bundle from: 'C:\Users\andrus\AppData\Local\Temp\{117FA21A-25D2-4824-8818-C7D6D9371B93}\.be\psqlodbc-setup.exe' to: 'C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\psqlodbc-setup.exe'
[20C4:3430][2020-02-28T11:44:48]i320: Registering bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}, version: 12.1.100.0
[20C4:3430][2020-02-28T11:44:48]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: Active, restart initiated: No, disable resume: No
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x86.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x86.msi, moving to: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi.
[20C4:3710][2020-02-28T11:44:48]i305: Verified acquired payload: psqlodbc_x64.msi at path: C:\ProgramData\Package Cache\.unverified\psqlodbc_x64.msi, moving to: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi.
[20C4:3430][2020-02-28T11:44:48]i323: Registering package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, version: 12.01.0100, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:48]i301: Applying execute package: psqlodbc_x86.msi, action: Install, path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\psqlodbc_x86.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:44:51]i319: Applied execute package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:44:51]i325: Registering dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:44:51]i323: Registering package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, version: 12.01.0100, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:44:51]i301: Applying execute package: psqlodbc_x64.msi, action: Install, path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\psqlodbc_x64.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to install MSI package.
[20C4:3430][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to configure per-machine MSI package.
[1648:3760][2020-02-28T11:45:12]i319: Applied execute package: psqlodbc_x64.msi, result: 0x80070643, restart: None
[1648:3760][2020-02-28T11:45:12]e000: Error 0x80070643: Failed to execute MSI package.
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x64.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:12]i319: Applied rollback package: psqlodbc_x64.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:12]i329: Removed package dependency provider: {336AD014-1E8E-4773-B840-C54A1669BAAB}, package: psqlodbc_x64.msi
[20C4:3430][2020-02-28T11:45:12]i351: Removing cached package: psqlodbc_x64.msi, from path: C:\ProgramData\Package Cache\{336AD014-1E8E-4773-B840-C54A1669BAAB}v12.01.0100\
[20C4:3430][2020-02-28T11:45:12]i326: Removed dependency: {d350bf53-a7d7-4110-a949-143967bfc13c} on package provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:12]i301: Applying rollback package: psqlodbc_x86.msi, action: Uninstall, path: (null), arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
[1648:3760][2020-02-28T11:45:13]i319: Applied rollback package: psqlodbc_x86.msi, result: 0x0, restart: None
[20C4:3430][2020-02-28T11:45:13]i329: Removed package dependency provider: {F7DA4A35-8117-4949-8206-653DF0893745}, package: psqlodbc_x86.msi
[20C4:3430][2020-02-28T11:45:13]i351: Removing cached package: psqlodbc_x86.msi, from path: C:\ProgramData\Package Cache\{F7DA4A35-8117-4949-8206-653DF0893745}v12.01.0100\
[20C4:3430][2020-02-28T11:45:13]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart: None, disable resume: No
[20C4:3430][2020-02-28T11:45:13]i330: Removed bundle dependency provider: {d350bf53-a7d7-4110-a949-143967bfc13c}
[20C4:3430][2020-02-28T11:45:13]i352: Removing cached bundle: {d350bf53-a7d7-4110-a949-143967bfc13c}, from path: C:\ProgramData\Package Cache\{d350bf53-a7d7-4110-a949-143967bfc13c}\
[20C4:3430][2020-02-28T11:45:13]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{d350bf53-a7d7-4110-a949-143967bfc13c}, resume: None, restart initiated: No, disable resume: No
[1648:3760][2020-02-28T11:45:13]i399: Apply complete, result: 0x80070643, restart: None, ba requested restart:  No
 
Sent: Friday, February 28, 2020 12:51 AM
To: Andrus
Subject: Re: How to fix psqlODBC driver regression to get error message details
 
Hi,

Could you please try to add "D7=1" to your connection string?

regards,
Hiroshi Inoue

On 2020/02/27 23:06, Andrus wrote:
Hi!
 
Thank you.
My application uses connection strings only to provide zero configuration application for users.
How to specify this in connection string ?
 
Andrus.
 
Sent: Thursday, February 27, 2020 3:06 PM
To: Andrus
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
?
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!

Yes.
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.

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

contains:

errprimary = PQresultErrorField(pgres, PG_DIAG_MESSAGE_PRIMARY);

which gets only primary error message.

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

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

According to docs there is parameter

PG_DIAG_SCHEMA_NAME

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

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

Also following fields would be useful in error message:

PG_DIAG_MESSAGE_HINT
PG_DIAG_STATEMENT_POSITION
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 error message.

Andrus.

-----Algsõnum----- From: Inoue, Hiroshi
Sent: Thursday, February 27, 2020 4:43 AM
To: Andrus
Cc: [hidden email]
Subject: Re: How to fix psqlODBC driver regression to get error message details

Hi Andrus,

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

regards,
Hiroshi Inoue

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

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

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

For example, users got only generic error message like

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

Error message details like

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

are no more returned.

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

Some ideas:

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.

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

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

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.

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

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

Andrus.

Posted also in

https://stackoverflow.com/questions/60357505/how-to-fix-psqlodbc-driver-regression-to-get-error-message-details

and in pgsql-general mailist list.


Reply | Threaded
Open this post in threaded view
|

Re: How to fix psqlODBC driver regression to get error message details

Andrus Moor
Hi!
>Hmm, does bcrypt.dll exist in the machine?
 
No:
 
image


>Anyway please retry the test drivers on Windows for old OSs 12.01.0101 at
 
This worked.
Thank you.
 
Andrus.