Re: Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list

Поиск
Список
Период
Сортировка
От Francisco Leovey
Тема Re: Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list
Дата
Msg-id 812700.61747.qm@web51704.mail.re2.yahoo.com
обсуждение исходный текст
Ответ на Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list  (Richard Broersma <richard.broersma@gmail.com>)
Список pgsql-novice
A simple query
 
  select datname from pg_database
 
will return all the database names
 
 


--- On Tue, 11/3/09, Richard Broersma <richard.broersma@gmail.com> wrote:

From: Richard Broersma <richard.broersma@gmail.com>
Subject: [NOVICE] Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list
To: "Christopher Frank" <c.frank@gmail.com>
Cc: pgsql-novice@postgresql.org, "pgsql-jdbc" <pgsql-jdbc@postgresql.org>
Date: Tuesday, November 3, 2009, 3:36 PM

On Mon, Nov 2, 2009 at 1:05 PM, Christopher Frank <c.frank@gmail.com> wrote:

>> > As for JDBC, there may be something that gives equivalent information,
>> > but I
>> > couldn't find it.
>>
>> http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html
>>
>> getCatalogs()

> I had tried that but it only returned one database, the database to which I
> was already connected. There should have been 3 others.

I verified that the DatabaseMetaData.getCatalogs() only returns a
ResultSet with the currently connect database rather than all of the
databases in the PostgreSQL cluster.

I see there was a previous discussion on this topic, stating that
Databases and Catalogs are not the same, so only returning the
currently connected database is correct:

http://archives.postgresql.org/pgsql-jdbc/2007-02/msg00112.php

However, calling the DatabaseMetaData.getCatalogTerm() function states
that the PostgreSQL's equivalent to a Catalog is a "database".  For
this reason, it seems reasonable to me that getCatalogs() should
return a listing off all PostgreSQL databases.

If one really only wants the currently connected database,
Connection.getCatalog() will suffice.

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Mark H. Nichols"
Дата:
Сообщение: Re: Install problems for postgresql-8.4.1
Следующее
От: Kris Jurka
Дата:
Сообщение: Re: [JDBC] Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list