Re: Unhappy thoughts about pg_dump and objects inherited from template1 - Mailing list pgsql-hackers

From Philip Warner
Subject Re: Unhappy thoughts about pg_dump and objects inherited from template1
Date
Msg-id 3.0.5.32.20001109003321.02db18b0@mail.rhyme.com.au
Whole thread Raw
In response to Re: Unhappy thoughts about pg_dump and objects inherited from template1  (Jan Wieck <janwieck@Yahoo.com>)
Responses Re: Unhappy thoughts about pg_dump and objects inherited from template1  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
At 14:04 7/11/00 -0500, Jan Wieck wrote:
>> Thoughts?  At the moment I'm afraid that the functionality we have is
>> worse than the way prior versions behaved --- not least because anyone
>> who was putting user data in template1 has probably gotten used to the
>> prior behavior.  Maybe we should give up the whole idea of user data
>> in template1.
>
>    FWIW,  what  about having another "template0" database, where
>    nobody can add user data. Initially, template0 and  template1
>    are identically.  CREATE DATABASE get's a new switch (used by
>    the pg_dump output) that tells to create it from the  vanilla
>    template0  DB  (generalized, so someone can setup a couple of
>    template<n>'s)  and  all  objects  inherited  from  template1
>    (those not in template0) are regularly dumped per database.

All pg_dump really needs is the abilty to ask for a 'vanilla' database from
'CREATE DATABASE' or createdb. It can use lastsysoid for template1/0 do
dump all database definitions. Any altered system objects will not be
dumped, which is probably OK (and may even be the Right Thing).

The command to create the new database needs to ask for a vanilla database
somehow, but extending the SQL doesn't seem like a good idea. *Maybe* we
can use a new 'set' command to define the template database for the current
session:
   set pg_template <db-name>   create database...

or
   createdb --template=<db-name>

It would also be good to allow some kind of installation-wide default
template (not necessarily template1/0), which is overridden temporarily by
the 'set' command.

If we can do this, then we create template0 & 1 in the same way we create
template1 now, then set template1 as the default template.


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

Previous
From: Zeugswetter Andreas SB
Date:
Subject: AW: AW: AW: Issue NOTICE for attempt to raise lock leve l?
Next
From: Tom Lane
Date:
Subject: Re: Issue NOTICE for attempt to raise lock level?