Troubles with JDBC method DataBaseMetaData.getTables()

From: "Ricardo Capurro" <rcapurro(at)ats(dot)com(dot)ar>
To: <stefan(at)linux(dot)kapow(dot)dk>
Subject: Troubles with JDBC method DataBaseMetaData.getTables()
Date: 2003-02-05 13:30:35
Message-ID: EE4772CE54344647A684BB6FA676A27E375C44@crux.ats-ar.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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(at)linux(dot)kapow(dot)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(at)ats(dot)com(dot)ar
e-mail personal: mailto:Ricardo(dot)Capurro(at)mail(dot)com
web: <http://www.ats.com.ar> http://www.ats.com.ar
ICQ#: 103449056

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2003-02-05 16:29:08 Bug #893: Trigger causes database to crash
Previous Message Tom Lane 2003-02-05 06:25:03 Re: initdb core dump