8.0 beta4: Exception with setBoolean on char column

From: "Laferriere, Al" <ALaferriere(at)Sciforma(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: 8.0 beta4: Exception with setBoolean on char column
Date: 2004-11-02 06:32:42
Message-ID: 972DE2275147EA43B00BE0AB9CF3B77F03EF4E@server3.sciforma.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The web page http://www.postgresql.org/news/235.html says report
any/all problems in 8.0 to this address, so...

The following java code works fine on 7.4:

Class.forName("org.postgresql.Driver");

Connection conn =
DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgresdb
","xxx","");

Statement stmt = conn.createStatement();

stmt.execute("CREATE TABLE tt (ans char(1))");

stmt.close();

PreparedStatement pstmt =
conn.prepareStatement("INSERT INTO tt (ans) VALUES (?)");

pstmt.setBoolean(1, false);

pstmt.executeUpdate();

But, in 8.0.0beta4 on we get:

java.sql.SQLException: ERROR: column "ans" is of type character but
expression is of type boolean

at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecu
torImpl.java:1187)

at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImp
l.java:990)

at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:
138)

at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Stateme
nt.java:347)

at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdb
c2Statement.java:294)

at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2S
tatement.java:249)

at BoolTest.main(BoolTest.java:18)

OS = Windows XP Pro

Java version 1.5.0-b64

JDBC driver: pgdev.307.jdbc3.jar

There is no problem with setString(1,"0") or when tt column is declared
bool.

Also noted that on 8.0, trying to do a setString(1, "0") on a bool
column throws "column "ans" is of type boolean but expression is of
type text" where in 7.4 there is no problem.

Thanks.

-al laferriere

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message kael 2004-11-02 06:47:36 Possible bug: pg_hba.conf file
Previous Message Alex Koh 2004-11-02 06:31:10 Re: BUG #1302: Vacuumdb and vacuumlo should disable statement_timeout