Skip site navigation (1) Skip section navigation (2)

Re: Case folding in DatabaseMetaData

From: Barry Lind <barry(at)xythos(dot)com>
To: Benoit Menendez <benoitm(at)pacbell(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org, pgsql-odbc(at)postgresql(dot)org
Subject: Re: Case folding in DatabaseMetaData
Date: 2002-02-07 02:19:46
Message-ID: 3C61E442.4000908@xythos.com (view raw or flat)
Thread:
Lists: pgsql-jdbcpgsql-odbc
Benoit,

Postgres doesn't fold all table and column names to lowercase.  If the 
identifier is enclosed in quotes then the case is preserved.  Thus it is 
possible to have three tables all named test but differing in their case:

TEST
Test
test

can all exist at the same time.  However to reference TEST or Test the 
identifier would need to be quoted (i.e. select * from "TEST").  All 
unquoted references are folded to lowercase.

I haven't seen anything in the jdbc spec on how this should be handled. 
  Does anyone know what the spec says should be done in this area, or 
what other databases jdbc drivers do?

thanks,
--Barry


Benoit Menendez wrote:
> Since PostgreSQL folds all table and column names (to lowercase), 
> shouldn't the DatabaseMetaData calls do the same:
> 
>  
> 
> for example:
> 
>  
> 
> create table FOO ...
> 
>  
> 
> DatabaseMetaData.getColumns(null, null, "FOO", "%") returns nothing 
> since FOO has been folded to lowercase
> 
>  
> 
> The same goes with other DatabaseMetaData taking table or column names 
> (or patterns)...
> 
>  
> 
> A fix would be to use the case insensitive like operator when querying 
> system tables...
> 
>  
> 
> This applies to both ODBC and JDBC as far as I can tell...
> 
>  
> 
> I am using the latest stable versions of 7.2 and corresponding ODBC and 
> JDBC drivers...
> 
>  
> 
> Thanks for your comments on the subject...
> 
>  
> 
>     Benoit
> 



In response to

Responses

pgsql-odbc by date

Next:From: Benoit MenendezDate: 2002-02-07 04:46:49
Subject: Problem with ODBC driver and MSP 2002
Previous:From: Nhan Ngo DinhDate: 2002-02-03 20:26:58
Subject: Unicode support

pgsql-jdbc by date

Next:From: tonyDate: 2002-02-08 17:40:30
Subject: Mysterious vanishing '
Previous:From: Anders BengtssonDate: 2002-02-06 22:24:09
Subject: JDBC Connection startup cleaned up

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group