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(QueryExecutorImpl.java:1187)

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

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

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

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

      at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.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

Reply via email to