public inbox for [email protected]  
help / color / mirror / Atom feed
From: Joris Wit <[email protected]>
To: [email protected]
Subject: SQLSpecialColumns result set column names should change for ODBC 3 compatibility
Date: Fri, 13 Aug 2021 18:58:14 +0200
Message-ID: <[email protected]> (raw)

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

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.







reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: SQLSpecialColumns result set column names should change for ODBC 3 compatibility
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox