RE: PostgeSQL problems (Boolean vs Bit)

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Wed Nov 09 2005 - 08:25:58 EST

  • Next message: Andrus Adamchik: "Re: PostgeSQL problems (Boolean vs Bit)"

    Did you test in PostgreSQL 8.1 (which was only released yesterday, I
    think). I'm wondering if it is an 8.1 issue and/or the JDBC driver (not
    sure if it has been updated for 8.1 -- perhaps there is a newer JAR
    available). Could be that it's been there for a while. Just rambling
    ...

    /dev/mrg

    PS. Andrus, I'm noticing all your posts are in the middle of the night
    lately. Everything OK?

    -----Original Message-----
    From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Sent: Wednesday, November 09, 2005 5:34 AM
    To: cayenne-use..bjectstyle.org
    Subject: Re: PostgeSQL problems (Boolean vs Bit)

    I found why our tests never detected this problem - in Cayenne
    internally JDBC "BIT" column is mapped to PostgreSQL "boolean".
    However I can easily reproduce the problem by other means.
    Unfortunately there is no Cayenne solution - it seems like Postgres
    PreparedStatement simply doesn't support bit columns (I may need to
    poke around driver sources, maybe there is a way around?)

    Anyway, there is an easy fix on Postgres end - change "bit" columns
    to "boolean" in your table definition, leaving Cayenne mapping
    unchanged.

    Andrus

    On Nov 9, 2005, at 8:37 AM, Doychi wrote:
    > Hi All,
    >
    > I seem to be having some problems with PostgeSQL (8.1) and Cayenne
    > 1.2(M7).
    > I get the error (more details give below):
    >
    > java.sql.SQLException: ERROR: column "active" is of type bit but
    > expression
    > is of type boolean
    >
    > when I try to add a new user to my user table.
    >
    > CREATE TABLE users
    > (
    > active bit(1) NOT NULL,
    > administrator bit(1) NOT NULL,
    > email varchar(128) NOT NULL,
    > id int4 NOT NULL,
    > name varchar(50) NOT NULL,
    > "password" char(256) NOT NULL,
    > CONSTRAINT users_pkey PRIMARY KEY (id)
    > )
    >
    > I've set the modeler's db type for active and administrator to
    > "BIT", and
    > the Java type to "java.lang.Boolean". Is this correct?
    >
    > I did notice that there is an old closed bug in JIRA (http://
    > objectstyle.org/jir
    > a/secure/ViewIssue.jspa?key=CAY-55) that sounds like the same
    > problem. Did
    > some
    > thing creep back in? If so is there a file I can modify to fix this
    > problem unt
    > il the next mile stone?
    >
    > PS: I love Cayenne and am currently working on a project with
    > Cayenne and
    > Click and except for some teething problems I'm loving it.
    >
    > java.sql.SQLException: ERROR: column "active" is of type bit but
    > expression
    > is of type boolean
    > at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
    > (QueryExecut orImpl.java:1471)
    > at org.postgresql.core.v3.QueryExecutorImpl.processResults
    > (QueryExecutorImpl .java:1256)
    > at org.postgresql.core.v3.QueryExecutorImpl.execute
    > (QueryExecutorImpl.java:1 75)
    > at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
    > (AbstractJdbc2Statemen t.java:389)
    > at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags
    > (AbstractJdbc 2Statement.java:330)
    > at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate
    > (AbstractJdbc2St atement.java:282)
    > at
    > org.objectstyle.cayenne.access.jdbc.BatchAction.runAsIndividualQueries

    > (Ba tchAction.java:212)
    > at org.objectstyle.cayenne.access.jdbc.BatchAction.performAction
    > (BatchAction .java:117)
    > at org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery
    > (DataNodeQuery Action.java:95)
    > at org.objectstyle.cayenne.access.DataNode.performQueries
    > (DataNode.java:310) at
    > org.objectstyle.cayenne.access.DataContextCommitAction.commit
    > (DataContext CommitAction.java:181)
    > at org.objectstyle.cayenne.access.DataContext.commitChanges
    > (DataContext.java :950)
    >
    > --
    > Doychi
    > spdoychia..oychi-dina.ath.cx
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Nov 09 2005 - 08:26:00 EST