Re: DatabaseMetaData.getTables returns lower-case column names

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: DatabaseMetaData.getTables returns lower-case column names
Date: 2013-05-17 15:22:50
Message-ID: 51964B4A.2080504@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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 case depending 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.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Rui Zhu 2013-05-21 08:40:57 [PATCH] Driver.knownProperties key is "tcpKeepAlive", but URL parameter is created with "tcpkeepalive", which renders setTcpKeepAlive(boolean) uneffective
Previous Message Július Štroffek 2013-05-17 15:06:56 DatabaseMetaData.getTables returns lower-case column names