postgresql-jdbc.git / summary / log / commit / refs

commit    3cf175aaef3dedca693e6a5f3bae405c79c4eaf6
Author:   Dave Cramer <davecramer@gmail.com>
Commit:   GitHub <noreply@github.com>
Date:     Mon Oct 04 10:41:33 2021 +0000

    fix: Regressions caused by PR#1949 (#2266)


.../main/java/org/postgresql/jdbc/TypeInfoCache.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java b/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java index ee172321..4e902038 100644 --- a/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java +++ b/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java @@ -297,7 +297,25 @@ public class TypeInfoCache implements TypeInfo { } 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; + } + Integer i = this.pgNameToSQLType.get(pgTypeName); + if (i != null) { + return i; + } + + /* + All else fails then we will query the database. + save for future calls + */ + i = getSQLType(castNonNull(getPGType(pgTypeName))); + + pgNameToSQLType.put(pgTypeName, i); + return i; } public synchronized int getSQLType(int typeOid) throws SQLException { [parent: cef1e1faf0de]