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 71DED9DC801 for ; Mon, 19 Dec 2005 16:55:42 -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 45348-09 for ; Mon, 19 Dec 2005 16:55:43 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by postgresql.org (Postfix) with SMTP id E0E909DC810 for ; Mon, 19 Dec 2005 16:55:39 -0400 (AST) Received: (qmail 18969 invoked from network); 19 Dec 2005 20:55:37 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (davec@64.7.143.116) by net2.micro-automation.com with SMTP; 19 Dec 2005 20:55:37 -0000 In-Reply-To: <20051219201451.84589.qmail@web32012.mail.mud.yahoo.com> References: <20051219201451.84589.qmail@web32012.mail.mud.yahoo.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <81D78292-95EC-44DD-B4CE-D9708D42F21B@fastcrypt.com> Cc: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: Dave Cramer Subject: Re: Bug: Driver(8.2dev-500.jdbc3) does not handle boolean->BIT correctly Date: Mon, 19 Dec 2005 15:55:35 -0500 To: j.random.programmer X-Mailer: Apple Mail (2.746.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.156 required=5 tests=[AWL=0.156] X-Spam-Score: 0.156 X-Spam-Level: X-Archive-Number: 200512/83 X-Sequence-Number: 14414 The problem is that we don't know in advance if the underlying column is a bit, or a boolean. Postgresql supports both, the jdbc API doesn't appear to. We are now using bound variables and are binding that to a boolean type, not a bit type. We had to choose one of them, and boolean seems to be much more "boolean" than bit. Dave On 19-Dec-05, at 3:14 PM, j.random.programmer wrote: > Running against postgres 8.1 > > I have: > > create table foo (bit_val bit); > > If I now try to insert, via the driver's prepared > statement, a value of java boolean true into > the bit_val column, I get: > > --------------------------------- > ERROR COULD NOT SAVE..... > org.postgresql.util.PSQLException: ERROR: column > "bit_val" is of type bit but expression is of type > boolean > --------------------------------- > > This is totally wrong if my reading of the JDBC > spec is correct. Java boolean values should > be converted to bitval(1), possibly as '1' and > then converted back to boolean when read from > the database. > > If I go to psql directly, the following works fine: > > insert into foo (bit_val) values ('1'); > > THAT is what the driver should to as well. > > This is really hokey since it's breaking my > O/R mapping tool. > > Best regards, > --j > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ---------------------------(end of > broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >