Skip to content
Browse files

fix:regression from previous behaviour where setObject(index,object,V…

…ARHCAR) should call getString if it can't cast it to a string
  • Loading branch information
davecramer committed Dec 31, 2015
1 parent 9aa3142 commit 9d6389c57906c9d491087f8db9fa011d8308f8c2
Showing with 3 additions and 5 deletions.
  1. +3 −5 pgjdbc/src/main/java/org/postgresql/jdbc/
@@ -912,17 +912,15 @@ private static String castToString(final Object in) throws SQLException {
if (in instanceof String) {
return (String) in;
if (in instanceof Number || in instanceof Boolean || in instanceof Character
|| in instanceof java.util.Date) {
return in.toString();
if (in instanceof Clob) {
return asString((Clob) in);
//this behaviour is possibly atypical but the driver has done this historically
return in.toString();

} catch (final Exception e) {
throw cannotCastException(in.getClass().getName(), "String", e);
throw cannotCastException(in.getClass().getName(), "String");

private static PSQLException cannotCastException(final String fromType, final String toType) {

0 comments on commit 9d6389c

Please sign in to comment.