Re: DatabaseMetaData.getTables() is silently quoting table

From: Mark Lewis <mark(dot)lewis(at)mir3(dot)com>
To: Marc Herbert <Marc(dot)Herbert(at)continuent(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: DatabaseMetaData.getTables() is silently quoting table
Date: 2006-07-20 20:13:11
Message-ID: 1153426391.1634.307.camel@archimedes
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

This is because PostgreSQL allows the creation of case-sensitive table
names.

If you run: CREATE TABLE MY_TABLE ...;

then the created table name is my_table.

But if you run: CREATE TABLE "MY_TABLE" ...;

then the created table name is MY_TABLE.

So in order for PG to differentiate between my_table and MY_TABLE, the
getTables() function has to be case-sensitive.

-- Mark

On Thu, 2006-07-20 at 18:21 +0200, Marc Herbert wrote:
> Hi,
>
> If I create table MY_TABLE (unquoted uppercase), then my_table
> (lowercase) is actually created. This is clearly documented, so fine.
>
> <http://www.postgresql.org/docs/8.1/interactive/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS>
>
> But now if I use .getTables(null, null, "MY_TABLE", null) to ask
> whether this table actually exists, the answer is "no" (empty) because
> .getTables() acts like I quoted the MY_TABLE identifier.
>
> It's quite annoying to create a table and not be able to see it...
>
> Tested with postgresql-server.i686 8.0.7-1PGDG and 8.2dev-503
> Maybe this is a server-side issue?
>
>
> Cheers,
>
> Marc
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Marc Herbert 2006-07-21 14:19:29 Re: DatabaseMetaData.getTables() is silently quoting table identifiers?
Previous Message Marc Herbert 2006-07-20 18:52:49 "prepared" statements (Re: Limit vs setMaxRows issue)