SQLSpecialColumns result set column names should change for ODBC 3 compatibility

From: Joris Wit <postgresql(at)joriswit(dot)nl>
To: pgsql-odbc(at)postgresql(dot)org
Subject: SQLSpecialColumns result set column names should change for ODBC 3 compatibility
Date: 2021-08-13 16:58:14
Message-ID: a8e06c36-9d82-8e9a-c4b4-9b9c67285bb6@joriswit.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi,

I am using Microsoft SQL Server Management Studio (SSMS) to copy tables
from a PostgreSQL database to SQL Server using the ODBC driver. However,
this fails with an error that it cannot find the 'COLUMN_SIZE'. I think
this is because the result set of the SQLSpecialColumns function uses
the ODBC 2 column names, instead of the ODBC 3 column names.

According to Microsoft's docs, this is the difference between ODBC 2 and
3 in the result set column names:

ODBC 2.0 column    ODBC 3.x column
PRECISION          COLUMN_SIZE
LENGTH             BUFFER_LENGTH
SCALE              DECIMAL_DIGITS

The documentation also says that "applications bind by column number",
but evidently SSMS does not (in its ProviderDescriptors.xml file).

source:
https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlspecialcolumns-function?view=sql-server-ver15

When looking in the psqlODBC source code, I think in the
PGAPI_SpecialColumns function in info.c a check should be added to
support ODBC 3 (possibly using EN_is_odbc3()). When the check confirms
ODBC 3+ is used, the different column names should be used.

Greetings,
Joris Wit.

Browse pgsql-odbc by date

  From Date Subject
Next Message Dulanic 2021-08-17 18:36:01 SSMS ODBC Linked Server Issue
Previous Message Olagoke Akinyemi 2021-07-26 18:25:39 pgaudit extension installation