Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEada-000471-G4 for pgsql-odbc@arkaria.postgresql.org; Fri, 13 Aug 2021 17:06:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mEadZ-0004aA-7C for pgsql-odbc@arkaria.postgresql.org; Fri, 13 Aug 2021 17:06:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEaVp-0001EY-Hx for pgsql-odbc@lists.postgresql.org; Fri, 13 Aug 2021 16:58:29 +0000 Received: from spamfilter-20.sohoix.com ([2a00:9b60:1:0:1c00:a5ff:fe00:67a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEaVl-0004RQ-TG for pgsql-odbc@postgresql.org; Fri, 13 Aug 2021 16:58:28 +0000 Received: from ns504.sohosted.com ([185.232.250.11] helo=web504.sohosted.com) by spamfilter-20.sohoix.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1mEaVe-0000be-OG for pgsql-odbc@postgresql.org; Fri, 13 Aug 2021 16:58:21 +0000 Received: from [192.168.0.12] (g228058.upc-g.chello.nl [80.57.228.58]) (Authenticated sender: mail@joriswit.nl) by web504.sohosted.com (Postfix) with ESMTPSA id 6267D247F15 for ; Fri, 13 Aug 2021 18:58:17 +0200 (CEST) To: pgsql-odbc@postgresql.org From: Joris Wit Subject: SQLSpecialColumns result set column names should change for ODBC 3 compatibility Message-ID: Date: Fri, 13 Aug 2021 18:58:14 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-PPP-Message-ID: <162887389756.1084516.7264251353342965965@web504.sohosted.com> X-PPP-Vhost: joriswit.nl X-Originating-IP: 185.232.250.11 X-SpamExperts-Domain: web500.sohosted.com X-SpamExperts-Username: 185.232.250.11 Authentication-Results: sohoix.com; auth=pass smtp.auth=185.232.250.11@web500.sohosted.com X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.15) X-Recommended-Action: accept X-Filter-ID: Pt3MvcO5N4iKaDQ5O6lkdGlMVN6RH8bjRMzItlySaT9WLQux0N3HQm8ltz8rnu+BPUtbdvnXkggZ 3YnVId/Y5jcf0yeVQAvfjHznO7+bT5zZVytJA5YjUyLFQztiXX17ZikzEQxZehGIr5WQJyRNJxPm p87GC1OZvsh7yKER8spsiVTnuSq1ndVN0DyzJqpkeb4o0/MLsfRXq2B6Bj1eqFS1yo+tjEVHEW6d eCo4BKi9OUam4IZYjkHKRb3TflRb5H3dI0/uNk3/fiJI+sNw7B6IjGdSKn6aI9pXlx3shQzBNjU5 5VPpCg+e57XrER7mfbUIkkfZyw0cN5XuP6kfF3PuJfOIAQpYEteY7zmkHA9oX4/cIYvCqRpDTGmi 0vQyHKm3cvu1mEu7o6z1x6oaMdB6U90tkhZqlbyVKA6S4NeoeH3YteOlbHKoDX2BUSfUT/ju/pBx J6bJ0lK0TJkwkfrLkKfa9S7FkXIg87ji99yH1y4EaOIoBF492PfbJJBl3TQ3XNW75kcM0I7R0xJ3 Qj3dKxLhoxcmaInYbR5vlqGWiiX+bzd9BvBuS/E5qQ64Wfb2CYt82HtSGimVVE0moSCv9TR+UxzL ZWL8hwGBjhoiDZaHjjUjL+gPrBh/8n4kpYzALSfDrtQHo6yRgtyrJanFcr4Itwkq5a+DFzdTrCL9 8tMOBjDK6ECTeq1mqHFOSguV0TqC9t5Bx9sBk0JPuXUQK0mEwfGgiMuYJ9hVzQNWo1Fo1y1uDO6a SLA6LbYsyKs4SxESDRAus0seHsgliCzo6zsMBiN5CrtOSZw5b+4g8qiefHNaxY/Ofty+x4sE8WNF oIpeN9lEeiR+WLu4MXF+lgOMZNnTHdpwyyEiiJFVGOOo3Q8SAZrpQUF2I606iMoWiOu9SOMouzLB CSTh6qMGVn6jn6GOeis9YG1WoyiDm9+vcc14JCgITi0/b3wBJQpEro5ufGv8QflwtZAnOsNKpwS0 k+2CA1Aca4j2IX0/C7Iyho2jEX4UMATNBeUkqFXvNzhEWTfP6a3MNxPjGSfdN9Z1K9mwpt7oR/F1 oM29gThRk31TRgf1b+pEf0gQm8RUBRNRv7Ko22g4gTY1ckzFUUmhcVJ4fkBmwfx/CCg= X-Report-Abuse-To: spam@spamfilter-10.sohoix.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.