Re: TypeInfoCache.getPGType(pgTypeName) drops schema name when caching

Поиск
Список
Период
Сортировка
От Vladimir Sitnikov
Тема Re: TypeInfoCache.getPGType(pgTypeName) drops schema name when caching
Дата
Msg-id CAB=Je-EumgtG1m+XcSWMC0AScVs9HkAsUfXBgAwt9meVPFxVeA@mail.gmail.com
обсуждение исходный текст
Ответ на [JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching  (Michael Glaesemann <grzm@seespotcode.net>)
Ответы Re: TypeInfoCache.getPGType(pgTypeName) drops schema name when caching  (Michael Glaesemann <grzm@seespotcode.net>)
Список 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 по дате отправления:

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: [JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: [JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching