Re: template1, can there be a template2/3/4?

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Jim Mercer <jim(at)reptiles(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: template1, can there be a template2/3/4?
Date: 2001-06-04 16:53:59
Message-ID: 200106041653.f54Grx608590@jupiter.us.greatbridge.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jim Mercer wrote:
>
> as i understand the usage of template1, it holds the system catalogs,
> users, etc, etc.
>
> it is accessed as a quasi-shadow database supporting the actual production
> data databases.
>
> would it be possible for me to create a template2 and have some arbitrary
> database use it instead of template1?
>
> the reason i ask this is that it would be useful to have something to the
> effect of:
>
> database access startup for "sample" database.
>
> if exists sample_cat database, use it instead of template1
> otherwise use template1
>
> this way "sample" could have its own set of users, permissions, etc, etc.
>
> it would be a method for getting around the fact that a user in template1
> has access to all of the other databases, modulo per-database permissions
> via GRANT/REVOKE
>
> does this make any sense?

There is no such concept like a shadow database. I think
you've misunderstood something.

Except for a few shared relations, namely pg_database,
pg_shadow, pg_group and pg_log, every database has it's own
copy of the system catalog. The entire content (catalog and
so far created objects) is *copied* at createdb time from
whatever you specify as the template database. If you modify
the template database after, these changes don't make it into
the databases derived from it.

The shared catalogs are shared in the entire instance. So if
you want different sets of users, you need to run separate
postmasters for the different sets of databases.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2001-06-04 17:08:11 Re: datestyle
Previous Message Jim Mercer 2001-06-04 16:51:54 Re: template1, can there be a template2/3/4?