On Saturday 11 April 2009 9:10:33 am lists@mgreg.com wrote:
> On Apr 11, 2009, at 11:56 AM, Tom Lane wrote:
> > There are, although we don't spell the commands like that. This is
> > not
> > relevant to the question of whether it makes sense to connect without
> > being connected to a specific database. It doesn't, because the
> > catalogs that you have to inspect to find out anything are
> > database-specific.
> >
> > regards, tom lane
>
> I'm sorry, I'm confused by your reply. I may have said "table" when I
> meant "database". I believe it absolutely *does* make sense to
> connect without specifying a database first. What if you hit that
> edge case where there are in fact no databases? I suppose you could
> always run "createdb" just in case before you do anything else, but
> that seems counterintuitive.
>
> What do you mean when you say the "catalogs...are database-
> specific" ? If I'm understanding what you're saying, my whole point
> is that I don't want to be tied to a database to do any kind of
> querying about the PG engine itself. Does that make sense?
>
> Best,
> Michael
Might try looking at the pg_database file in ~/DATADIR/global. It lists the
databases in the cluster.
--
Adrian Klaver
aklaver@comcast.net