Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 7710C6323E9 for ; Wed, 28 Jul 2010 06:00:07 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 81154-02 for ; Wed, 28 Jul 2010 08:59:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id D83416318F3 for ; Wed, 28 Jul 2010 05:59:59 -0300 (ADT) Received: from 121-98-80-66.bitstream.orcon.net.nz ([121.98.80.66] helo=[192.168.1.2]) by tremor.opencloud.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Oe2UT-0001DU-NM; Wed, 28 Jul 2010 20:59:53 +1200 Message-ID: <4C4FF183.7040004@opencloud.com> Date: Wed, 28 Jul 2010 20:59:47 +1200 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: fortunasliebling@gmx.de CC: pgsql-jdbc@postgresql.org Subject: Re: Wrong SqlType for boolean columns References: <20100728072658.14770@gmx.net> In-Reply-To: <20100728072658.14770@gmx.net> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201007/114 X-Sequence-Number: 20779 fortunasliebling@gmx.de wrote: > i found out that my postgres driver maps a boolean column to the sqlType -7, wich is java.sql.Types.BIT and not java.sql.Types.Boolean (Boolean is 16). This is a very strange behavior. > > I think this is a bug within the jdbc-driver. It is not a bug. BOOLEAN does not exist in earlier JDBC versions, and drivers can map boolean types to either BIT or BOOLEAN. We pick BIT so we can build drivers for earlier JDBC versions. (BIT is something of a confusing type, as the mappings defined by JDBC for the JDBC BIT type only really make sense for a single boolean value, not a SQL BIT(n) type) See the datatype mapping tables in Appendix B of the JDBC spec. I agree that it is confusing, but that is just a reflection of the JDBC spec being confusing.. -O