SQLSpecialColumns result set column names should change for ODBC 3 compatibility - Mailing list pgsql-odbc

From Joris Wit
Subject SQLSpecialColumns result set column names should change for ODBC 3 compatibility
Date
Msg-id a8e06c36-9d82-8e9a-c4b4-9b9c67285bb6@joriswit.nl
Whole thread Raw
List 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.




pgsql-odbc by date:

Previous
From: Olagoke Akinyemi
Date:
Subject: pgaudit extension installation
Next
From: Dulanic
Date:
Subject: SSMS ODBC Linked Server Issue