Re: DatabaseMetaData.getTables() problem

From: Kris Jurka <jurka(at)ejurka(dot)com>
To: Barry Lind <blind(at)xythos(dot)com>
Cc: "w(dot)winter" <w(dot)winter(at)logitags(dot)com>, pgsql-jdbc(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: DatabaseMetaData.getTables() problem
Date: 2002-11-02 22:26:22
Message-ID: 3DC4510E.266D9F3D@ejurka.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

I have given this some further thought and believe that we should not do
any case folding in the driver for DatabaseMetaData calls. We cannot
guess what the caller's intention is regarding case handling, so instead
the driver provides the necessary methods to let the user know what the
database does with regard to case. The following methods allow the
caller to do their own case folding if necessary:

storesLowerCaseIdentifiers
storesLowerCaseQuotedIdentifiers
storesMixedCaseIdentifiers
storesMixedCaseQuotedIdentifiers
storesUpperCaseIdentifiers
storesUpperCaseQuotedIdentifiers
supportsMixedCaseIdentifiers
supportsMixedCaseQuotedIdentifiers

The attached patch removes the existing case folding in the driver.

Barry Lind wrote:
>
> Kris,
>
> I can't think of anything better. So yes please submit a patch for this.
>
> thanks,
> --Barry
>
> Kris Jurka wrote:
> > This has not been fixed. Currently the driver is doing something along
> > the lines of
> >
> > " WHERE c.relname LIKE " + tableNamePattern.toLowerCase();
> >
> > This masks the problem of a user supplying an uppercase version of a
> > tablename that was case folded to lower, but does not work when they
> > really want an uppercase table name.
> >
> > I believe that adding a LOWER() to c.relname is the best temporary
> > solution until we figure out a better way to handle case sensitivity.
> >
> > Barry, If you believe this is the way to go I will work up a patch for
> > this an similar places in the driver.
> >
> > Kris Jurka
> >
> >
> > On Tue, 29 Oct 2002, Barry Lind wrote:
> >
> >
> >>Wolfgang,
> >>
> >>Can you try this test using the 7.3beta3 build of the driver from
> >>jdbc.postgresql.org? I think this should be fixed in the latest build.
> >>
> >>thanks,
> >>--Barry
> >>
> >>
> >>w.winter wrote:
> >>
> >>>Hi,
> >>>
> >>>on testing our auto-configuration persistence framework ACP against
> >>>PostgreSQL we found the following problem:
> >>>
> >>>There is a table A625431658_Person1, created as quoted mixed case
> >>>identifier.
> >>>
> >>>I do:
> >>>databaseMetaData.getTables(null, null, "%", new String[] {"TABLE"})
> >>>--> A625431658_Person1 is in the ResultSet. OK.
> >>>
> >>>I do:
> >>>databaseMetaData.getTables(null, null, "A625431658_Person1", new String[]
> >>>{"TABLE"})
> >>>--> A625431658_Person1 is NOT in the ResultSet.
> >>>
> >>>I do:
> >>>databaseMetaData.getTables(null, null, "%erson1", new String[] {"TABLE"})
> >>>--> A625431658_Person1 is in the ResultSet. OK.
> >>>
> >>>Seems there is a problem with mixed case ?
> >>>
> >>>
> >>>Wolfgang
> >>>
> >>>___________________
> >>>Dr. Wolfgang Winter
> >>>LogiTags Systems
> >>>www.logitags.com

Attachment Content-Type Size
case.patch text/plain 17.1 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Antonie C Malan 2002-11-02 23:53:54 Question arising from a post
Previous Message am 2002-11-02 19:33:43 Re: Cursors: getting the number of tuples; moving backwards

Browse pgsql-patches by date

  From Date Subject
Next Message Kris Jurka 2002-11-04 04:40:58 Re: not fully fixed
Previous Message Reinhard Max 2002-10-31 17:53:52 Re: Compiler options for plperl