Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id E53316348EC for ; Tue, 3 Nov 2009 13:57:54 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 66263-07 for ; Tue, 3 Nov 2009 17:57:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from web51704.mail.re2.yahoo.com (web51704.mail.re2.yahoo.com [206.190.38.222]) by mail.postgresql.org (Postfix) with SMTP id E2809634779 for ; Tue, 3 Nov 2009 13:57:43 -0400 (AST) Received: (qmail 62765 invoked by uid 60001); 3 Nov 2009 17:57:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1257271062; bh=Fywl6g1RZk8ZA5BNMcWS3YN0kCQZQR4nX8DpTP6F9w0=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=Wq3x2Q5BysAa+qCzE8H17gmMnPOOlQCtzbFmvv3ZRBXSvaikqGNnK+tfCO93GRFuho+nu8RaJjuNxK/98WRlhLSuJQwxq266fNXncgCiwuuIVN3WII6up4CVnwJsWkxSPrdJTBHkhLPPjrUgYanIrIO9uzSJ9XDuIApvbbnUfcc= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=N/zMvFmS+mXJ+i83iftYLhtX6P60xE6oqJtw/9ADxcqSOS3o05DUbkvIL2+qOFSUsZWae/UrziNSYehUSMQyS/4ZeorcrPHlzOh10OZSJR3WmH9YYrzI7lRBW8BHkpYvzQj2aH9yaE1Vuxhc8960YyQF3EQbR+QMYlKh4lpLbLI=; Message-ID: <812700.61747.qm@web51704.mail.re2.yahoo.com> X-YMail-OSG: SrKgvL0VM1n25fBJx.6EoA8XwCGDJqPt49Dg_lCcjv8Pu0oredkrMw59RLfpdyQNQiQhkWyLpYt_DaYwUFLJdORAq9TuWioWaxMGI4Mg9txLILP1DXJ6Z7H1wrwaOV7TicKrQWbQNIH2TyXRzIbsw_AuUBq5lxW4qjf1Fd3V.Vnh_8Re_5QzvJOss9RhGwBCeWjwi.yODhmderSZvZdkTm.yejErjuHnU4uYcD2UjHwgpwakF6d.1o7aKjh3xDOvBHiBL3OmBzU7Wa6XYwvE3wmQmvuUuUYfj._5RUYSBc3U8LsAoLxnRfggbKWdkag.Q_sqSk3_614TQaSMRI7ntqjMPl97c9vowHWzYPJF2BXA8qvz7jN3xo5jUVapby_MYGXeDc1nAI01Q7baGKOg3UNDCfv7RZcnVwkorxOLV7M2FUonW.OLYvFGBleY6j.O5vEm.KwXlDbVFYvaEQY3MUIKrkakjRKYc0DKduFP8g-- Received: from [200.49.84.72] by web51704.mail.re2.yahoo.com via HTTP; Tue, 03 Nov 2009 09:57:42 PST X-Mailer: YahooMailClassic/7.0.14 YahooMailWebService/0.7.361.4 Date: Tue, 3 Nov 2009 09:57:42 -0800 (PST) From: Francisco Leovey Subject: Re: Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of databases with \list To: c.frank@gmail.com Cc: pgsql-novice@postgresql.org In-Reply-To: <396486430911030936r725f6163m3384fad30721b36c@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-2122801851-1257271062=:61747" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200911/52 X-Sequence-Number: 22276 --0-2122801851-1257271062=:61747 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable A simple query=20 =A0 =A0 select datname from pg_database =A0 will return all the database names =A0 =A0 --- On Tue, 11/3/09, Richard Broersma wrote: From: Richard Broersma Subject: [NOVICE] Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't g= et list of databases with \list To: "Christopher Frank" Cc: pgsql-novice@postgresql.org, "pgsql-jdbc" Date: Tuesday, November 3, 2009, 3:36 PM On Mon, Nov 2, 2009 at 1:05 PM, Christopher Frank 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".=A0 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. --=20 Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug --=20 Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-novice =0A=0A=0A --0-2122801851-1257271062=:61747 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
=0A=0A=0A=0A --0-2122801851-1257271062=:61747--
A simple query
 
  select da= tname from pg_database
 
will return all the database names
 
 


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

From: Richard Broersma <richard.broersma@gmail= .com>
Subject: [NOVICE] Bug - DatabaseMetaData.getCatalogs() was [Nov= ice] 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 &l= t;c.frank@gmail.com> wrote:
>> > As for JDBC, there may be something that gives equivale= nt information,
>> > but I
>> > couldn't find it.>>
>> http://java.sun.com/javase/6/d= ocs/api/java/sql/DatabaseMetaData.html
>>
>> getCatal= ogs()

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

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

I see there was a previou= s discussion on this topic, stating that
Databases and Catalogs are not t= he same, so only returning the
currently connected database is correct:<= BR>
http://archives.postgresql.org/pgsql-jdbc/2007-02/ms= g00112.php

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

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

--
Regards,
Richard Broersma Jr.

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

--
Sent via pgsql-novice mailing list (
pgsql-novice@postg= resql.org)
To make changes to your subscription:
http://www.post= gresql.org/mailpref/pgsql-novice