Обсуждение: DatabaseMetaData.getTables returns lower-case column names

Поиск
Список
Период
Сортировка

DatabaseMetaData.getTables returns lower-case column names

От
Július Štroffek
Дата:
Hi,

I am using eclipselink with pgsql jdbc driver '9.2-1002 JDBC 4' and
when eclipselink tries to get the list of available tables using the
${subject} function PostgreSQL JDBC will return the result having the
column names lower case.

The JDBC API clearly describes them as upper-case, see

http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getTables%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String[]%29

Is there any reason why the names are returned as lower case?

Please keep me CC-ed as I am not on this list.

Thank you,
Kind regards

Julo

--
Julius Stroffek
http://www.stroffek.cz


Re: DatabaseMetaData.getTables returns lower-case column names

От
Thomas Kellerer
Дата:
Július Štroffek wrote on 17.05.2013 17:06:
> I am using eclipselink with pgsql jdbc driver '9.2-1002 JDBC 4' and
> when eclipselink tries to get the list of available tables using the
> ${subject} function PostgreSQL JDBC will return the result having the
> column names lower case.
>
> The JDBC API clearly describes them as upper-case, see
>
http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html#getTables%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String[]%29

I don't see any statement that claims the table or column names should be returned in upper case.

The driver should always return the names as _stored in the database_ which could mean lowercase, uppercase or mixed
casedepending on the DBMS. To find out _how_ the DBMS stores them you can use storesLowerCaseIdentifiers(),
storesMixedCaseIdentifiers()and storesUpperCaseIdentifiers() 

> Is there any reason why the names are returned as lower case?

Yes, because Postgres stores all (unquoted) identifiers in lowercase.