Thread: BUG #1119: DatabaseMetaData.getTables() returns not a lot

BUG #1119: DatabaseMetaData.getTables() returns not a lot

From
"PostgreSQL Bugs List"
Date:
The following bug has been logged online:

Bug reference:      1119
Logged by:          Andy Jefferson

Email address:      lists@ajsoft.net

PostgreSQL version: 7.3.2

Operating system:   Linux

Description:        DatabaseMetaData.getTables() returns not a lot

Details:

Hi,

Firstly I'm using the following on Linux
postgresql-server-7.3.2-5.1.91mdk
postgresql-7.3.2-5.1.91mdk
postgresql-jdbc-7.3.2-5.1.91mdk
postgresql-docs-7.3.2-5.1.91mdk

I connect with JDBC to jdbc:postgresql:jpox
i.e to a database "jpox" on my local machine. Connects fine.

If I call DatabaseMetaData.getTables(null,null,"my_table",null); I get a
ResultSet with nothing in it (rs.getNext() == false)

The table certainly exists in this DB !!

If I do DatabaseMetaData.getCatalogs(); I get
jpox
template0
template1

and if I do DatabaseMetaData.getSchemas(); I get
pg_catalog
public


So why does getTables() return nothing ? I've tried putting "%" at front and
end of the "my_table". No effect. I've seen mention of a bug back in v 7.2
for JDBC. Is this also in 7.3 ? If so, is there a workaround ?

I tried to use your mailing lists to report this and see if anyone else has
seen the same ... but after registering and trying posting with 3 different
email addresses and nothing ever appearing I decided to report here.

I really should submit a bug report about your mailing lists as well since
they basically either dont allow people to register, or dont allow them to
send messages.

Re: BUG #1119: DatabaseMetaData.getTables() returns not a

From
Kris Jurka
Date:
On Sun, 28 Mar 2004, PostgreSQL Bugs List wrote:

> PostgreSQL version: 7.3.2
> Description:        DatabaseMetaData.getTables() returns not a lot
>
> If I call DatabaseMetaData.getTables(null,null,"my_table",null); I get a
> ResultSet with nothing in it (rs.getNext() == false)
>
> The table certainly exists in this DB !!
>

As with any jdbc problem the standard advice is to upgrade to the latest
stable version of the driver (the 7.4 series) available from here
http://jdbc.postgresql.org/download.html which is backwards compatible
with 7.3 servers and see if the problem persists.

One of the things that we played around with for a while before agreeing
on how to handle it was the case of the name given and the name in the
database.  I don't recall what we did in 7.3.2, but currently you must
match the case exactly with the server's name ie MYTABLE won't match
mytable.  Another thing to try would be to put just "%" as the table name
and see what happens.

Kris Jurka