pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dave Cramer <pg@fastcrypt.com>
To: maly.velky@email.cz
Cc: pgsql-jdbc@postgresql.org
Subject: Re: BUG: DatabaseMetaData.getColumns isn't case insensitive
Date: Mon, 2 Feb 2009 16:32:13 -0500
Message-ID: <491f66a50902021332w66598e8fhe6a2ed5b3a3ad8d1@mail.gmail.com> (raw)
In-Reply-To: <1711.2738-17750-2075670179-1233581999@email.cz>
References: <1711.2738-17750-2075670179-1233581999@email.cz>

Shouldn't you quote the column in question if you want to get a MixedCase
quoted column ?

Dave

On Mon, Feb 2, 2009 at 8:39 AM, <maly.velky@email.cz> wrote:

> Hello,
>
> I'was trying to get meta data of a column and discovered that the column
> name is case sensitive though it should be case insensitive. I don't know if
> this can be somehow determined by a configuration or environment change
> because I believe that till recently it  worked in a case-insensitive
> manner.
>
> I've the table studna_monitor.mon_user_session with the column "username".
> The following code wrongly returns null (notice "username".toUpperCase()):
> ---
> String col = null;
> Class.forName("org.postgresql.Driver");
> String url = "jdbc:postgresql://localhost/mydb?user=me&password=secret";
> Connection conn = DriverManager.getConnection(url);
>        DatabaseMetaData databaseMetaData = conn.getMetaData();
>        ResultSet columnsMD = databaseMetaData.getColumns(null,
> "studna_monitor", "mon_user_session", "username".toUpperCase());
>        while(columnsMD.next()) {
>                col = columnsMD.getString("COLUMN_NAME");
>        }
>        return col;
> ---
> While the following returns the column name "username":
> ---
> ...
> ResultSet columnsMD = databaseMetaData.getColumns(null, "studna_monitor",
> "mon_user_session", "username".toLowerCase());
> ...
> ---
>
> BTW, the metadata reports:
> supportsMixedCaseIdentifiers: false
> supportsMixedCaseQuotedIdentifiers: true
> (which is pretty much expected)
>
> Driver: postgresql-8.3-604.jdbc3.jar, postgresql-jdbc3-8.2.jar (as
> distributed with Ubuntu, doesn't provide build number)
> Server:  Postgres 8.2.6 for Solaris
>
>
> Thank you.
> Jakub Holy
> maly.velky@email.cz
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>

view thread (5+ messages)  latest in thread

Message-ID: <491f66a50902021332w66598e8fhe6a2ed5b3a3ad8d1@mail.gmail.com>
Permalink:  ../491f66a50902021332w66598e8fhe6a2ed5b3a3ad8d1@mail.gmail.com/
Also on:    postgresql.org/message-id/491f66a50902021332w66598e8fhe6a2ed5b3a3ad8d1@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pg@fastcrypt.com, maly.velky@email.cz
  Subject: Re: BUG: DatabaseMetaData.getColumns isn't case insensitive
  In-Reply-To: <491f66a50902021332w66598e8fhe6a2ed5b3a3ad8d1@mail.gmail.com>
  References: <1711.2738-17750-2075670179-1233581999@email.cz> <491f66a50902021332w66598e8fhe6a2ed5b3a3ad8d1@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox