Re: Connect without specifying a database?

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

"lists(at)mgreg(dot)com" <lists(at)mgreg(dot)com> writes:
> 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?

No, it does not. This is perhaps an implementation quirk of Postgres's,
but it does have some advantages and we're not interested in giving them
up just because it confuses MySQLers ;-). The main advantage is that
having separate catalogs in each database is more robust (no matter how
badly database A gets messed up, database B will be okay) and reduces
contention for catalog access.

There are a few catalogs that are visible in all databases of an
installation (pg_database itself being the most obvious one) but they
are not sufficient to support an operational backend. So you have to
connect to some database even to query those catalogs.

We could have a convention that there is some database that you connect
to only for the purpose of inspecting pg_database, but there doesn't
seem a whole lot of point in trying to enforce that. The standard
databases serve well enough.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2009-04-11 16:52:21 Re: Connect without specifying a database?
Previous Message Adrian Klaver 2009-04-11 16:35:23 Re: Connect without specifying a database?