pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Walter Couto <Walter.Couto@EMBARCADERO.COM>
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Re: Missing meta data information for bit and bit varying
Date: Thu, 12 Jun 2014 17:18:54 +0300
Message-ID: <5399B6CE.3080204@vmware.com> (raw)
In-Reply-To: <7FA4F9E5512F214C801E596ECD8790E066A8499F@ETNAMAIL01.embarcadero.com>
References: <7FA4F9E5512F214C801E596ECD8790E066A8499F@ETNAMAIL01.embarcadero.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

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



view thread (4+ messages)  latest in thread

Message-ID: <5399B6CE.3080204@vmware.com>
Permalink:  ../5399B6CE.3080204@vmware.com/
Also on:    postgresql.org/message-id/5399B6CE.3080204@vmware.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: hlinnakangas@vmware.com, Walter.Couto@EMBARCADERO.COM
  Subject: Re: Missing meta data information for bit and bit varying
  In-Reply-To: <5399B6CE.3080204@vmware.com>
  References: <7FA4F9E5512F214C801E596ECD8790E066A8499F@ETNAMAIL01.embarcadero.com> <5399B6CE.3080204@vmware.com>

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

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