Skip site navigation (1) Skip section navigation (2)

Re: Exception when inserting boolean values into BIT columns

From: Thomas Dudziak <tomdzk(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Exception when inserting boolean values into BIT columns
Date: 2005-06-20 12:23:37
Message-ID: 224f323405062005231457ebaa@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
On 6/20/05, Oliver Jowett <oliver(at)opencloud(dot)com> wrote:
> As I understand it, JDBC's BIT/BOOLEAN types (single boolean value)
> aren't the same as PostgreSQL's BIT type (bit string). The JDBC driver
> maps setBoolean(), setObject(...,Types.BIT), and
> setObject(...,Types.BOOLEAN) to the 'boolean' datatype.
> 
> Try using the boolean type in your schema, assuming what you want to
> store is a single boolean value. If you really want a bitstring, you'll
> probably need to do something nasty like pass the value via setString()
> and use 'pg_catalog.bit(?)' in your query to do the type conversion
> (CAST AS doesn't seem to work from brief testing)

Ah, yes, didn't notice that. Yep, I wanted to store a boolean value,
so I'll use postgresql's boolean type instead.

Thanks for pointing this out to me,
Tom

In response to

pgsql-jdbc by date

Next:From: Akhil SrinivasanDate: 2005-06-20 16:05:06
Subject: Re: Problems with temporary tables created in callable functions
Previous:From: Oliver JowettDate: 2005-06-20 12:10:32
Subject: Re: Exception when inserting boolean values into BIT columns

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group