Re: Connect without specifying a database?

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: "lists(at)mgreg(dot)com" <lists(at)mgreg(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Connect without specifying a database?
Date: 2009-04-11 16:35:23
Message-ID: 200904110935.23697.aklaver@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Saturday 11 April 2009 9:10:33 am lists(at)mgreg(dot)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(at)comcast(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-04-11 16:50:22 Re: Connect without specifying a database?
Previous Message lists@mgreg.com 2009-04-11 16:10:33 Re: Connect without specifying a database?