X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id E189F9DC9E6 for ; Mon, 19 Dec 2005 19:41:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20783-01 for ; Mon, 19 Dec 2005 19:41:42 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web32012.mail.mud.yahoo.com (web32012.mail.mud.yahoo.com [68.142.207.109]) by postgresql.org (Postfix) with SMTP id 88AD99DC86B for ; Mon, 19 Dec 2005 19:41:37 -0400 (AST) Received: (qmail 59716 invoked by uid 60001); 19 Dec 2005 23:41:36 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=oyrAdsnTG7fJi/yHTUlHAJzpSXvU0ZNpAW0vZC7mxHZjx4I/mo2lhuZiXTMwLQwzv/zEWuftMKeauBn8dBxAFYS1OlASmgNhIKfYd22POGjm3gjXjUZZ2KaUO9c9GutLAR6OUL0VL1OwniQf00qKhWaQ0lj50ckNXPTds9IgBm4= ; Message-ID: <20051219234136.59714.qmail@web32012.mail.mud.yahoo.com> Received: from [165.123.243.168] by web32012.mail.mud.yahoo.com via HTTP; Mon, 19 Dec 2005 15:41:36 PST Date: Mon, 19 Dec 2005 15:41:36 -0800 (PST) From: "j.random.programmer" Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org In-Reply-To: <43A742F0.8040801@opencloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.449 required=5 tests=[AWL=-0.030, DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.449 X-Spam-Level: X-Archive-Number: 200512/88 X-Sequence-Number: 14419 > JDBC's "BIT" is actually a boolean type. In > JDBC3, BIT and BOOLEAN are effectively > equivalent. Hmm. > The backend's "bit" type is actually a bitstring > that does not have a > direct equivalent in JDBC. Aha ! So postgres really has a BITSTRING which is conceptually different from a BIT type ? (since BIT is also used instead of BITSTRING, you can see why there is bound to be confusion). Anywho, in the JDBC driver, why not convert java booleans as follows: true -> '1' false -> '0' and store that in the BIT column ? While retrieving, do the reverse conversion. Of course, if someone has the following in the BIT column '1001010' then: a) allow the entire value to be retrieved as a String (getString...) b) If there are any 1's present, return true is retrieving it as boolean, false if all 0's. Best, -j __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com