pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedBug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list
5+ messages / 4 participants
[nested] [flat]
* Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list
@ 2009-11-03 17:36 Richard Broersma <richard.broersma@gmail.com>
0 siblings, 3 replies; 5+ messages in thread
From: Richard Broersma @ 2009-11-03 17:36 UTC (permalink / raw)
To: Christopher Frank <c.frank@gmail.com>; +Cc: pgsql-novice@postgresql.org; pgsql-jdbc
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list
@ 2009-11-03 17:57 Francisco Leovey <fleovey@yahoo.com>
parent: Richard Broersma <richard.broersma@gmail.com>
2 siblings, 0 replies; 5+ messages in thread
From: Francisco Leovey @ 2009-11-03 17:57 UTC (permalink / raw)
To: c.frank@gmail.com; +Cc: pgsql-novice@postgresql.org
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list
@ 2009-11-03 18:16 Kris Jurka <books@ejurka.com>
parent: Richard Broersma <richard.broersma@gmail.com>
2 siblings, 0 replies; 5+ messages in thread
From: Kris Jurka @ 2009-11-03 18:16 UTC (permalink / raw)
To: Richard Broersma <richard.broersma@gmail.com>; +Cc: Christopher Frank <c.frank@gmail.com>; pgsql-novice@postgresql.org; pgsql-jdbc
On Tue, 3 Nov 2009, Richard Broersma wrote:
> 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.
>
The previous discussion to refer to is probably:
http://archives.postgresql.org/pgsql-jdbc/2004-01/msg00164.php
Crippling getCatalogs was the best proposed solution to the fact that no
other catalog based functionality existed (or could).
Kris Jurka
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [NOVICE] Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list
@ 2009-11-03 18:29 Michael Wood <esiotrot@gmail.com>
parent: Richard Broersma <richard.broersma@gmail.com>
2 siblings, 1 reply; 5+ messages in thread
From: Michael Wood @ 2009-11-03 18:29 UTC (permalink / raw)
To: Richard Broersma <richard.broersma@gmail.com>; +Cc: Christopher Frank <c.frank@gmail.com>; pgsql-novice@postgresql.org; pgsql-jdbc
2009/11/3 Richard Broersma <richard.broersma@gmail.com>:
> 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.
What does it do when you have multiple schemas (schemata?) in the database?
--
Michael Wood <esiotrot@gmail.com>
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [NOVICE] Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list
@ 2009-11-03 18:39 Richard Broersma <richard.broersma@gmail.com>
parent: Michael Wood <esiotrot@gmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: Richard Broersma @ 2009-11-03 18:39 UTC (permalink / raw)
To: Michael Wood <esiotrot@gmail.com>; +Cc: Christopher Frank <c.frank@gmail.com>; pgsql-novice@postgresql.org; pgsql-jdbc
On Tue, Nov 3, 2009 at 10:29 AM, Michael Wood <esiotrot@gmail.com> wrote:
> What does it do when you have multiple schemas (schemata?) in the database?
It returns a ResultSet listing all of the schemas:
Where is what I get when I tested it:
a
b
c
information_schema
pg_catalog
pg_toast_temp_1
public
--
Regards,
Richard Broersma Jr.
Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2009-11-03 18:39 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-11-03 17:36 Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list Richard Broersma <richard.broersma@gmail.com>
2009-11-03 17:57 ` Francisco Leovey <fleovey@yahoo.com>
2009-11-03 18:16 ` Re: Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list Kris Jurka <books@ejurka.com>
2009-11-03 18:29 ` Michael Wood <esiotrot@gmail.com>
2009-11-03 18:39 ` Richard Broersma <richard.broersma@gmail.com>
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