Troubles with JDBC method DataBaseMetaData.getTables()

Started by Ricardo Capurroabout 23 years ago2 messagesbugs
Jump to latest
#1Ricardo Capurro
rcapurro@ats.com.ar

Hi PostgreSQL developers,

I am having trouble with PostgreSQL's implementation of DataBaseMetaData.getTables() and looking at the code I found this comment and so I am writing to you.

The problem I am having is that If I create tables with uppercase letters like this

create table "FOO" ( "NUM" numeric );

then I can´t use this code to check if the table exists

ResultSet rs = conn.getMetaData().getTables( null, null, "FOO", null );
Boolean exists = rs.next();

I suppose it´s because the tableNamePattern is being converted toLowerCase()

// Added by Stefan Andreasen <stefan@linux.kapow.dk>
// Now take the pattern into account
sql.append(") and relname like '");
sql.append(tableNamePattern.toLowerCase());
sql.append("' order by relkind, relname");

I suggest to eliminate this conversion and leave the user do the conversion if he desires.

Greetings

Ricardo Andrés Capurro
Senior Software Developer
ATS Advanced Technology Solutions S.A.
Av. Corrientes 880 Piso 11
(C1043AAV) Buenos Aires
Argentina
Tel: +54-11-6393-4345 +54-11-4393-4345
Fax: +54-11-6393-4300
e-mail laboral: mailto:rcapurro@ats.com.ar
e-mail personal: mailto:Ricardo.Capurro@mail.com
web: <http://www.ats.com.ar&gt; http://www.ats.com.ar
ICQ#: 103449056

Attachments:

image001.gifimage/gif; name=image001.gifDownload
#2Kris Jurka
books@ejurka.com
In reply to: Ricardo Capurro (#1)
Re: Troubles with JDBC method DataBaseMetaData.getTables()

On Wed, 5 Feb 2003, Ricardo Capurro wrote:

I suppose it�s because the tableNamePattern is being converted toLowerCase()
I suggest to eliminate this conversion and leave the user do the
conversion if he desires.

If you upgrade to a newer version of the JDBC driver you will find your
suggestion has been implemented.

Kris Jurka