Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wv5qM-0000el-Fz for pgsql-odbc@arkaria.postgresql.org; Thu, 12 Jun 2014 14:19:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wv5qL-0001Ng-HG for pgsql-odbc@arkaria.postgresql.org; Thu, 12 Jun 2014 14:19:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Wv5qK-0001Na-V5 for pgsql-odbc@postgresql.org; Thu, 12 Jun 2014 14:19:05 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Wv5qF-0006nA-Ur for pgsql-odbc@postgresql.org; Thu, 12 Jun 2014 14:19:03 +0000 Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 7EE3EA18A8; Thu, 12 Jun 2014 07:18:56 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 78EF943411; Thu, 12 Jun 2014 07:18:56 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 0BEB4C0059; Thu, 12 Jun 2014 07:19:09 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Thu, 12 Jun 2014 07:19:08 -0700 (PDT) Message-ID: <5399B6CE.3080204@vmware.com> Date: Thu, 12 Jun 2014 17:18:54 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: Walter Couto , "pgsql-odbc@postgresql.org" Subject: Re: Missing meta data information for bit and bit varying References: <7FA4F9E5512F214C801E596ECD8790E066A8499F@ETNAMAIL01.embarcadero.com> In-Reply-To: <7FA4F9E5512F214C801E596ECD8790E066A8499F@ETNAMAIL01.embarcadero.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.6 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On 06/11/2014 11:50 PM, Walter Couto wrote: > Have a table similar to the one below: > > CREATE TABLE bitstring_test > ( > test integer NOT NULL, > bit_col bit(47), > bitvarying_col bit varying(47), > PRIMARY KEY (test) > ) > > You can before a select * from the table above and observe what information is given back to you by the ODBC driver for the bit and bit varying colums: > > > 1) Both bit_col and bitvarying_col return "unknown" for the type name (SQLColAttribute using SQL_DESC_TYPE_NAME). This appears to be due to the fact that in pgtypes.c the method pgtype_attr_to_name is missing the case for PG_TYPE_BIT and is missing the #define and case for bit varying(1562). > > 2) For bit_col, calls to SQLColAttribute passing either SQL_DESC_LENGTH or SQL_DESC_DISPLAY_SIZE both return the value 255. Which is not what the size is stated above but at least it is bigger :). > > 3) For bitvarying_col, calls to SQLColAttribute passing either SQL_DESC_LENGTH or SQL_DESC_DISPLAY_SIZE return the value 43. Which is not correct and smaller than what is stated above so this can cause problems. :( > > Any idea if I there is a way for me to avoid problem 3) as I can't tell from the type name what I am looking at. The list of built-in types that the internal pgtype_attr_to_name() function knows about haven't been updated for a long time. At a quick glance, it's also seems to be missing all range and array types, for example. Given that writing custom data types is a very prominent feature in PostgreSQL, it would be nice if we could do better than check against a hard-coded list of built-in functions. I think SQLColAttribute(SQL_DESC_TYPE_NAME) should query the pg_type catalog to get the type name. Patches are welcome.. - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc