Skip to content

Commit

Permalink
fix startup regressions caused by PR pgjdbc#1949. Instead of checking…
Browse files Browse the repository at this point in the history
… all types by OID, we can return types for well known types
  • Loading branch information
davecramer committed Sep 21, 2021
1 parent 2917c1f commit 58a588c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java
Expand Up @@ -286,7 +286,22 @@ private PreparedStatement prepareGetTypeInfoStatement() throws SQLException {
}

public synchronized int getSQLType(String pgTypeName) throws SQLException {
return getSQLType(castNonNull(getPGType(pgTypeName)));
/*
Get a few things out of the way such as arrays and known types
*/
if (pgTypeName.endsWith("[]")) {
return Types.ARRAY;
}else {
Integer i = (Integer) this.pgNameToSQLType.get(pgTypeName);
if (i != null) {
return i;
} else {
/*
All else fails then we will query the database.
*/
return getSQLType(castNonNull(getPGType(pgTypeName)));
}
}
}

public synchronized int getSQLType(int typeOid) throws SQLException {
Expand Down

0 comments on commit 58a588c

Please sign in to comment.