Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1A0A0133798F for ; Wed, 3 Nov 2010 05:37:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 89399-04 for ; Wed, 3 Nov 2010 08:36:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by mail.postgresql.org (Postfix) with SMTP id 295B713364DE for ; Wed, 3 Nov 2010 05:36:55 -0300 (ADT) Received: (qmail 31802 invoked by uid 512); 3 Nov 2010 08:36:52 -0000 Received: from unknown (HELO ?127.0.0.1?) (100.0.32.252) by sd2.tpf-fw-c.co.jp with SMTP; 3 Nov 2010 08:36:52 -0000 Message-ID: <4CD11F17.5050207@tpf.co.jp> Date: Wed, 03 Nov 2010 17:36:39 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: Adrien de Croy CC: "pgsql-odbc@postgresql.org" Subject: Re: Various errors in psqlodbc: SQLGetTypeInfo, SQLTables, bigint, and double vs float References: <6B48F83ECA0ABA4F9E360E8E0A1CDFFC35E4AE0E@HALLEY.maeil.pt> <4CD09C7F.9070403@tpf.co.jp> <4CD0D584.30908@qbik.com> In-Reply-To: <4CD0D584.30908@qbik.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.157 tagged_above=-10 required=5 tests=BAYES_00=-1.9, DNS_FROM_RFC_BOGUSMX=1.668, RCVD_ILLEGAL_IP=3.399, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: *** X-Archive-Number: 201011/9 X-Sequence-Number: 10494 Hi, (2010/11/03 12:22), Adrien de Croy wrote: > > Hi all, > > apologies if this is already in the bug tracker (I had a look but didn't > find it). > > We recently did some work to get our product working with PostgreSQL 9.0 > and the latest ODBC driver. Our code is written to (try to) be > DBMS-agnostic. So it enumerates reported types, searches for matching > types etc, and builds CREATE TABLE statements etc from what it finds. > > There were a couple of inconsistencies in data returned from the ODBC > driver. > > 1. Data returned from SQLGetTypeInfo uses ODBC2 field names. > > The columns reported include > > "PRECISION" instead of "COLUMN_SIZE" > "MONEY" instead of "FIXED_PREC_SCALE" > "AUTO_INCREMENT" instead of "AUTO_UNIQUE_VALUE" > > 2. Data returned from SQLTables uses ODBC2 field names > > "TABLE_QUALIFIER" instead of "TABLE_CAT" > "TABLE_OWNER" instead of "TABLE_SCHEM" > > These 2 issues aren't huge problems, since the ordinal column number > stays the same. > > 3. Not all supported types returned by SQLGetTypeInfo > > Specifically the types SERIAL and BIGSERIAL are not reported. This means > we needed to hard-code a hack so if the driver was PostgreSQL and we > needed an AUTO_UNIQUE_VALUE counter, we used "SERIAL". It works, but if > SQLGetTypeInfo returned these types, it wouldn't need the hack. > > 4. Oddness with bigint fields. > > bigint reported as precision of 19, instead of 20. This isn't big enough > to store an unsigned __int64 Because int8 type in PostgreSQL is signed, the precision is 19. > 5. Oddness with double precision fields. > > We had to use double precision fields to store file size information, > because bigint couldn't do an __int64 (not sure what actual C type this > really maps to in reality). However when we get the field data back in a > query, it is reported as type SQL_FLOAT, even though the DB structure in > the PostgreSQL manager shows it as double precision. Obviously you don't > want to truncate double to float, so is this just in the driver (some > type switch case not supported?) SQL_FLOAT means double precision type. What means signle precision type is SQL_REAL. > Once we worked around all these issues, it seems to be working great. > I'm a bit concerned about losing precision with double vs float though. > > Regards > > Adrien