8.0 beta4: Exception with setBoolean on char column

Поиск
Список
Период
Сортировка
От Laferriere, Al
Тема 8.0 beta4: Exception with setBoolean on char column
Дата
Msg-id 972DE2275147EA43B00BE0AB9CF3B77F03EF4E@server3.sciforma.com
обсуждение исходный текст
Ответы Re: 8.0 beta4: Exception with setBoolean on char column  (Kris Jurka <books@ejurka.com>)
Список pgsql-bugs
The web page http://www.postgresql.org/news/235.html  says report
any/all problems in 8.0 to this address, so...

=20

The following java code works fine on 7.4:

=20

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

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

=20

                        Statement stmt =3D conn.createStatement();

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

                        stmt.close();

=20

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

                        pstmt.setBoolean(1, false);

                        pstmt.executeUpdate();

=20

But, in 8.0.0beta4 on we get:

=20

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)

=20

=20

OS =3D Windows XP Pro

Java version 1.5.0-b64

JDBC driver: pgdev.307.jdbc3.jar

=20

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

=20

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.

=20

Thanks.

=20

-al laferriere

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: JDBC driver. Class Cast Exception when calling
Следующее
От: "Alex Koh"
Дата:
Сообщение: Re: BUG #1302: Vacuumdb and vacuumlo should disable statement_timeout