Re: TypeInfoCache.getPGType(pgTypeName) drops schema name when caching - Mailing list pgsql-jdbc

From Vladimir Sitnikov
Subject Re: TypeInfoCache.getPGType(pgTypeName) drops schema name when caching
Date
Msg-id CAB=Je-EumgtG1m+XcSWMC0AScVs9HkAsUfXBgAwt9meVPFxVeA@mail.gmail.com
Whole thread Raw
In response to [JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching  (Michael Glaesemann <grzm@seespotcode.net>)
Responses Re: TypeInfoCache.getPGType(pgTypeName) drops schema name when caching  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-jdbc
Michael>_pgNameToOid.put(schema + "." + name, oid)
Michael>I think it makes sense to follow this behavior in getPGType(pgTypeName). 

The idea of type cache is to avoid pg_catalog SQLs on the hot path.
Consider a user issuing `createArrayOf`. Do you mean pgjdbc should query the catalog on each invocation of createArrayOf? I'm not sure it would be the right thing, as it is basically the only way to create arrays.

Theoretically, there's java.sql.SQLType (since Java 1.8), however I don't thing 1.8-specific APIs (e.g. implementing TypeCache via Map<java.sql.SQLType, ...>) would be a good idea at this point.

Michael>search path. This results in the cache returning unqualified type

I think that is a separate issue and we might handle "search path" changes by flushing the cache of user-provided names.

"search path change detector" has already been implemented (see https://github.com/pgjdbc/pgjdbc/blob/a7e0c83be93600c6299ae99907942e2530cb5e30/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L2088-L2096 ), so it makes sense to reuse it and flush type cache accordingly.

Vladimir

pgsql-jdbc by date:

Previous
From: Michael Glaesemann
Date:
Subject: [JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching
Next
From: Michael Glaesemann
Date:
Subject: Re: [JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching