pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Dudziak <tomdzk@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Exception when inserting boolean values into BIT columns
Date: Mon, 20 Jun 2005 14:23:37 +0200
Message-ID: <224f323405062005231457ebaa@mail.gmail.com> (raw)
In-Reply-To: <42B6B238.5090208@opencloud.com>
References: <224f3234050620030565ffa711@mail.gmail.com>
	<42B6B238.5090208@opencloud.com>

On 6/20/05, Oliver Jowett <oliver@opencloud.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



view thread (3+ messages)

Message-ID: <224f323405062005231457ebaa@mail.gmail.com>
Permalink:  ../224f323405062005231457ebaa@mail.gmail.com/
Also on:    postgresql.org/message-id/224f323405062005231457ebaa@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tomdzk@gmail.com
  Subject: Re: Exception when inserting boolean values into BIT columns
  In-Reply-To: <224f323405062005231457ebaa@mail.gmail.com>
  References: <224f3234050620030565ffa711@mail.gmail.com> <42B6B238.5090208@opencloud.com> <224f323405062005231457ebaa@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox