From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: How to retrieve column names for tables with underscores
Date: Thu, 24 Mar 2011 14:12:58 +0100
Message-ID: <imfg0q$481$1@dough.gmane.org> (raw)
Hi,
this is probably more of a generic JDBC question, but since I'm trying to solve this with Postgres I'm posting it here:
I have two tables
table1_ (yes there is an underscore at the end)
table12
Now when I try to retrieve the columns for "table_" the columns of table12 are also returned because the table name parameter for DatabaseMetaData.getColumns() is used as a LIKE expression.
Is there a way (preferrably standard JDBC) to avoid the LIKE evaluation with the getColumns() call e.g. by specifying an escape character?. I tried to replace the underscore with the standard backslash escape ("table1\_") but that didn't work.
Or is the only reliable way to check the value of the returned TABLE_NAME whether it matches my input value?
Thanks
Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: How to retrieve column names for tables with underscores
In-Reply-To: <imfg0q$481$1@dough.gmane.org>
References: <imfg0q$481$1@dough.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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