Bug: SimpleParameterList and resolved types
От | Bruno De Fraine |
---|---|
Тема | Bug: SimpleParameterList and resolved types |
Дата | |
Msg-id | 8B9C0191-CBBB-497B-B2EE-7CAF63971D34@defraine.net обсуждение исходный текст |
Ответы |
Re: Bug: SimpleParameterList and resolved types
|
Список | pgsql-jdbc |
Hello, I'm experiencing a problem with a new version of the PostgreSQL JDBC driver. Under a condition that has got to do with theinvocation of getMetaData(), the execution of a prepared statement raises an error "Can't change resolved type for param:1 from 1043 to 25" (from SimpleParameterList) for (what seems to me) a perfectly valid insert statement. I've created a simple test case to reproduce the bug. I use the following database: CREATE DATABASE bug; \connect bug CREATE TABLE foo ( id serial PRIMARY KEY, value text NOT NULL, date timestamp DEFAULT now() NOT NULL ); The test case (in attachment) will execute the following insert statement: insert into foo(value,date) values (?,?) returning id With the following result: Driver version: PostgreSQL 8.4 JDBC4 (build 701) Database version: PostgreSQL 8.4.3 on i386-apple-darwin9.7.0, compiled by GCC i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (AppleInc. build 5465), 32-bit Exception in thread "main" java.lang.IllegalArgumentException: Can't change resolved type for param: 1 from 1043 to 25 at org.postgresql.core.v3.SimpleParameterList.setResolvedType(SimpleParameterList.java:230) at org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1488) at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1062) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271) at Bug.triggerBug(Bug.java:31) at Bug.main(Bug.java:10) I found that I can do three things to workaround this error at the moment: 1) Include a "prepare threshold" in the URL: jdbc:postgresql:bug?prepareThreshold=1 2) Comment out the call to ps.getMetaData() (but I need that in my actual app) 3) Use an older version of postgresql-jdbc; at least the following worked: Driver version: PostgreSQL 8.3 JDBC3 with SSL (build 604) Database version: PostgreSQL 8.4.3 on i386-apple-darwin9.7.0, compiled by GCC i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (AppleInc. build 5465), 32-bit 1 Best regards, Bruno De Fraine
Вложения
В списке pgsql-jdbc по дате отправления: