Re: Reported lengths of char fields - psqlODBC

From: Clemens Ladisch <clemens(at)ladisch(dot)de>
To: pgsql-odbc(at)lists(dot)postgresql(dot)org
Subject: Re: Reported lengths of char fields - psqlODBC
Date: 2019-02-09 07:57:18
Message-ID: 703d9962-2e04-83ab-3a36-8988dd2cc8d7@ladisch.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Bob Brodd wrote:
> Postgresql v 9.5.14
> psqlODBC v1:09.03.0300-1

Please note that newer versions of the ODBC driver are backwards compatible,
and have bug fixes.

> I created a simple table containing one column of type character (n).
> When I ask for the width of the column via (ODBC)SQLColAttribute function,
> it answers (n*6)

I guess you are asking not for SQL_DESC_LENGTH but SQL_DESC_OCTET_LENGTH?
The latter multiplies the column size (in characters) by the maximum possible
number of bytes per character, which is 4 in the Unicode driver, and 6 when
using UTF-8 as client encoding. (In driver version 9.6.3, the UTF-8 value
was corrected to 4.)

Regards,
Clemens

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Pierre Couderc 2019-02-20 10:42:50 problem with _ character
Previous Message Bob Brodd 2019-02-05 22:23:45 Reported lengths of char fields - psqlODBC