Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use PostgreSQL column type name in error message #1422

Merged
merged 1 commit into from Feb 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 23 additions & 23 deletions pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
Expand Up @@ -3215,14 +3215,14 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
if (sqlType == Types.NUMERIC || sqlType == Types.DECIMAL) {
return type.cast(getBigDecimal(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == String.class) {
if (sqlType == Types.CHAR || sqlType == Types.VARCHAR) {
return type.cast(getString(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Boolean.class) {
Expand All @@ -3233,7 +3233,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(booleanValue);
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Short.class) {
Expand All @@ -3244,7 +3244,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(shortValue);
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Integer.class) {
Expand All @@ -3255,7 +3255,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(intValue);
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Long.class) {
Expand All @@ -3266,7 +3266,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(longValue);
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == BigInteger.class) {
Expand All @@ -3277,7 +3277,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(BigInteger.valueOf(longValue));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Float.class) {
Expand All @@ -3288,7 +3288,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(floatValue);
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Double.class) {
Expand All @@ -3299,21 +3299,21 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(doubleValue);
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Date.class) {
if (sqlType == Types.DATE) {
return type.cast(getDate(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Time.class) {
if (sqlType == Types.TIME) {
return type.cast(getTime(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Timestamp.class) {
Expand All @@ -3324,7 +3324,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
) {
return type.cast(getTimestamp(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Calendar.class) {
Expand All @@ -3341,21 +3341,21 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
calendar.setTimeInMillis(timestampValue.getTime());
return type.cast(calendar);
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Blob.class) {
if (sqlType == Types.BLOB || sqlType == Types.BINARY || sqlType == Types.BIGINT) {
return type.cast(getBlob(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Clob.class) {
if (sqlType == Types.CLOB || sqlType == Types.BIGINT) {
return type.cast(getClob(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == java.util.Date.class) {
Expand All @@ -3366,21 +3366,21 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(new java.util.Date(timestamp.getTime()));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == Array.class) {
if (sqlType == Types.ARRAY) {
return type.cast(getArray(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == SQLXML.class) {
if (sqlType == Types.SQLXML) {
return type.cast(getSQLXML(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == UUID.class) {
Expand Down Expand Up @@ -3418,21 +3418,21 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(localDateTimeValue.toLocalDate());
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == LocalTime.class) {
if (sqlType == Types.TIME) {
return type.cast(getLocalTime(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == LocalDateTime.class) {
if (sqlType == Types.TIMESTAMP) {
return type.cast(getLocalDateTime(columnIndex));
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
} else if (type == OffsetDateTime.class) {
Expand All @@ -3452,7 +3452,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
OffsetDateTime offsetDateTime = OffsetDateTime.ofInstant(timestampValue.toInstant(), ZoneOffset.UTC);
return type.cast(offsetDateTime);
} else {
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}
//#endif
Expand All @@ -3465,7 +3465,7 @@ public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
}
return type.cast(object);
}
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, sqlType),
throw new PSQLException(GT.tr("conversion to {0} from {1} not supported", type, getPGType(columnIndex)),
PSQLState.INVALID_PARAMETER_VALUE);
}

Expand Down