[JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching
От | Michael Glaesemann |
---|---|
Тема | [JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching |
Дата | |
Msg-id | 72F45272-226E-47FC-940F-F5E5FF446222@seespotcode.net обсуждение исходный текст |
Ответы |
Re: [JDBC] TypeInfoCache.getPGType(pgTypeName) drops schema name when caching
Re: TypeInfoCache.getPGType(pgTypeName) drops schema name when caching |
Список | pgsql-jdbc |
When populating the _oidToPgName and _pgNameToOid caches, TypeInfoCache.getPGType(String pgTypeName) populates _oidToPgNamewith only pg_type.typname regardless of typnamespace or the search path. This results in the cache returningunqualified type names in lookups to cached values by getPGType(int oid). It makes sense to normalize the name, which is presumably what motivates using internalName returned from oidStatement ratherthan the user-supplied pgTypeName. getPGType(oid) does schema-qualify the name used to populate _oidToPgName: _pgNameToOid.put(schema + "." + name, oid) I think it makes sense to follow this behavior in getPGType(pgTypeName). Looking at it briefly, I wonder if adding "nspname= ANY(current_schemas(true))" and nspname columns to the results of oidStatement would be sufficient, and usingthose to construct a normalized qualified type name in the manner of getPGType(oid). If this makes sense, I'm happy to submit a patch with tests. Cheers, Michael Glaesemann grzm seespotcode net PS. When looking through open issues to see if this had been reported, I came across https://github.com/pgjdbc/pgjdbc/issues/189"Connection.createArrayOf() does not handle enums correctly.". I think what Idescribe above is the root cause of this as well, as TypeInfoCache.getPGArrayType calls getPGType(pgTypeName).
В списке pgsql-jdbc по дате отправления: