Bug in implementation of java.sql.DatabaseMetaData

Поиск
Список
Период
Сортировка
От Alessandro Di Bella
Тема Bug in implementation of java.sql.DatabaseMetaData
Дата
Msg-id AANLkTiki00kRRo3dkpM4sK3D-F7aPnrtHTmegSG0HUWt@mail.gmail.com
обсуждение исходный текст
Список pgsql-jdbc
Hi,

accordingly to the JDBC specification (

http://download.oracle.com/javase/1.4.2/docs/api/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)
), when calling

public ResultSet java.sql.DatabaseMetaDatagetColumns(String
catalog,String schemaPattern,String tableNamePattern, String
columnNamePattern) throws SQLException

the column TYPE_NAME String should contain the data source dependent
type name that for a user defined type (UDT), the type name is fully
qualified.

However, the JDBC driver ignores the schema the type is defined into
and just return the simple name.

Thus, is impossible to handle multiple types with the same name in
different schema.

I found that the core problem is in
org.postgresql.jdbc2.TypeInfoCache.getPGType(String) where the sql
should be something like:

SELECT pg_namespace.nspname || '.' || pg_type.typname FROM
pg_catalog.pg_type JOIN pg_catalog.pg_namespace ON pg_namespace.oid =
pg_type.typnamespace WHERE pg_type.oid = ?;

Unfortunately that method is used everywhere and I wasn't too sure on
how to change so I changed the
org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData instead.

The attached patch refers to a checkout of the  REL8_4_STABLE.

Can you please integrate my change or fix the problem as you see fit?

Thanks

Alessandro

Вложения

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: JDBC: "transaction aborted"
Следующее
От: Kyran O Reilly
Дата:
Сообщение: Re: Can't connect to posgresql through the jdbc driver