pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedDatabaseMetaData.getTables() is silently quoting table identifiers?
3+ messages / 2 participants
[nested] [flat]
* DatabaseMetaData.getTables() is silently quoting table identifiers?
@ 2006-07-20 16:21 Marc Herbert <Marc.Herbert@continuent.com>
0 siblings, 2 replies; 3+ messages in thread
From: Marc Herbert @ 2006-07-20 16:21 UTC (permalink / raw)
To: pgsql-jdbc
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: DatabaseMetaData.getTables() is silently quoting table
@ 2006-07-20 20:13 Mark Lewis <mark.lewis@mir3.com>
parent: Marc Herbert <Marc.Herbert@continuent.com>
1 sibling, 0 replies; 3+ messages in thread
From: Mark Lewis @ 2006-07-20 20:13 UTC (permalink / raw)
To: Marc Herbert <Marc.Herbert@continuent.com>; +Cc: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: DatabaseMetaData.getTables() is silently quoting table identifiers?
@ 2006-07-21 14:19 Marc Herbert <Marc.Herbert@continuent.com>
parent: Marc Herbert <Marc.Herbert@continuent.com>
1 sibling, 0 replies; 3+ messages in thread
From: Marc Herbert @ 2006-07-21 14:19 UTC (permalink / raw)
To: pgsql-jdbc
Marc Herbert <Marc.Herbert@continuent.com> writes:
> 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?
I finally did my archeology homework:
Date: 2002-10-27 09:39:54 GMT
Subject: DatabaseMetaData.getTables() problem
<http://comments.gmane.org/gmane.comp.db.postgresql.jdbc/1614;
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-07-21 14:19 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-20 16:21 DatabaseMetaData.getTables() is silently quoting table identifiers? Marc Herbert <Marc.Herbert@continuent.com>
2006-07-20 20:13 ` Re: DatabaseMetaData.getTables() is silently quoting table Mark Lewis <mark.lewis@mir3.com>
2006-07-21 14:19 ` Marc Herbert <Marc.Herbert@continuent.com>
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