Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsNWy-0007qE-G3 for pgsql-odbc@arkaria.postgresql.org; Sat, 09 Feb 2019 07:58:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gsNWv-0006UP-Hp for pgsql-odbc@arkaria.postgresql.org; Sat, 09 Feb 2019 07:58:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsNWv-0006UI-37 for pgsql-odbc@lists.postgresql.org; Sat, 09 Feb 2019 07:58:29 +0000 Received: from webclient5.webclient5.de ([2a01:4f8:212:88::2]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsNWr-0007db-BL for pgsql-odbc@lists.postgresql.org; Sat, 09 Feb 2019 07:58:27 +0000 Received: from olorin.ladisch.de (x59cc8a32.dyn.telefonica.de [89.204.138.50]) by webclient5.webclient5.de (Postfix) with ESMTPSA id 5D0CB5583A61 for ; Sat, 9 Feb 2019 08:58:21 +0100 (CET) Subject: Re: Reported lengths of char fields - psqlODBC To: pgsql-odbc@lists.postgresql.org References: From: Clemens Ladisch Message-ID: <703d9962-2e04-83ab-3a36-8988dd2cc8d7@ladisch.de> Date: Sat, 9 Feb 2019 08:57:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.99.4 at webclient5 X-Virus-Status: Clean List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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