Re: template1, can there be a template2/3/4? - Mailing list pgsql-general

From Tom Lane
Subject Re: template1, can there be a template2/3/4?
Date
Msg-id 6241.991671203@sss.pgh.pa.us
Whole thread Raw
In response to template1, can there be a template2/3/4?  (Jim Mercer <jim@reptiles.org>)
Responses Re: template1, can there be a template2/3/4?  (Jim Mercer <jim@reptiles.org>)
List pgsql-general
Jim Mercer <jim@reptiles.org> writes:
> would it be possible for me to create a template2 and have some arbitrary
> database use it instead of template1?

In 7.1, you can tell CREATE DATABASE to clone any existing database,
not only template1.  However, this doesn't seem to have much to do with
what you are really after.

> this way "sample" could have its own set of users, permissions, etc, etc.

Users (also groups) are installation-wide, so there's no way to have
database-specific users.  AFAICS, the only thing the alternate-template
facility is good for is to preinstall languages, tables, etc into some
databases and not others.

> 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

Which database you are connected to has nothing whatever to do with
whether you can see/manipulate other databases.  template1 is certainly
not special in that regard.  The only reason createdb and friends
connect to template1 is that it's the only DB name they can be pretty
certain exists.

            regards, tom lane

pgsql-general by date:

Previous
From: Martín Marqués
Date:
Subject: Re: datestyle
Next
From: Jim Mercer
Date:
Subject: Re: template1, can there be a template2/3/4?