Hello.
Today I've got next exception on postgresql 9.0-801 jdbc4 driver:
Caused by: org.postgresql.util.PSQLException: Unsupported Types value: 2,001
at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1745)
at org.postgresql.jdbc3.AbstractJdbc3Statement.setObject(AbstractJdbc3Statement.java:1483)
at org.postgresql.jdbc3g.AbstractJdbc3gStatement.setObject(AbstractJdbc3gStatement.java:47)
at org.postgresql.jdbc4.AbstractJdbc4Statement.setObject(AbstractJdbc4Statement.java:69)
at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1751)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:163)
at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:163)
at org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:356)
at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:144)
at org.springframework.jdbc.core.simple.AbstractJdbcInsert.setParameterValues(AbstractJdbcInsert.java:611)
at org.springframework.jdbc.core.simple.AbstractJdbcInsert.access$1(AbstractJdbcInsert.java:602)
at org.springframework.jdbc.core.simple.AbstractJdbcInsert$1.createPreparedStatement(AbstractJdbcInsert.java:439)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:580)
After looking a little deeper I've foudn out that driver report domain type as Types.DISTINCT, but does not accept it in setObject call. And spring library uses metadata to fill default SQL types to be sent to driver. I did a workaround by hard-wiring Types.OTHER, but I suppose this to be driver bug as driver should accept any sql type it provides from metadata.
--
Best regards,
Vitalii Tymchyshyn