Stephen Ingram <ingram@samsix.com> writes:
> On Saturday 02 February 2002 08:30 pm, Annie Bai wrote:
>> How can I access the system databases? when I use '\l', i can only get
>> those databases created by specific users. Is there a particular directory
>> holding all the system databases?
There are no "system databases"; only the ones you see with -l.
There are a few tables (pg_database, pg_shadow, pg_group) that are
actually system-wide; each has a single instance that's visible
in all databases of an installation. Everything else is local to
a particular database. For example, each database has its own
copy of pg_class, which is what makes it possible for each database
to have a different set of tables.
> I am guessing when one creates a database, the template information
> is copied across and PG then holds separate instances of system tables
> in each database.
Check.
> I don't know the details but I can only 'connect' to template1,
> not template0.
This is intentional; template0 isn't supposed to be modified, or indeed
used for anything except as a source template for CREATE DATABASE.
There is a better explanation of this in the 7.2 docs than there was in
7.1, see "template databases" at
http://developer.postgresql.org/docs/postgres/managing-databases.html
regards, tom lane