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

Re: BUG #3894: JDBC DatabaseMetaData.getTables is inconsistently case-sensitive with schema name

From: Kris Jurka <books(at)ejurka(dot)com>
To: Adam Hardy <adam(dot)hardy(at)cyberspaceroad(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3894: JDBC DatabaseMetaData.getTables is inconsistently case-sensitive with schema name
Date: 2008-01-23 08:51:39
Message-ID: Pine.BSO.4.64.0801230344310.12286@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-bugs

On Tue, 22 Jan 2008, Adam Hardy wrote:

>
> The following bug has been logged online:
>
> Bug reference:      3894
> Description:        JDBC DatabaseMetaData.getTables is inconsistently
> case-sensitive with schema name
> Details:
>
> create schema DEV;
>
> but then DatabaseMetaData.getTables(null, "DEV", "%", new String[]
> {"TABLE"}) returned an empty resultset.
>
> However giving it the schema name "dev" returns the full resultset.
>

This is by design.  While SQL provides case folding and quoting rules 
those are not the same as the JDBC driver's rules.  In SQL an unquoted 
identifier is case folded while quoted identifiers are not.  To provide 
the most straightforward mapping for the JDBC driver, we require an exact 
match because quoting in Java String objects isn't the same as SQL.  It 
would be odd to say getTable(..., "\"Dev\"",...) to imply that you wanted 
a case sensitive match.  Even odder would it be to do a search for a 
schema with a quote in it's name using SQL identifier rules in Java code.

Kris Jurka

In response to

Responses

pgsql-bugs by date

Next:From: Adam HardyDate: 2008-01-23 09:33:55
Subject: Re: BUG #3894: JDBC DatabaseMetaData.getTables is inconsistently case-sensitive with schema name
Previous:From: Stephan SzaboDate: 2008-01-23 01:09:48
Subject: Re: bad message or bad privilege check in foreign key constraint

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