Re: Unhappy thoughts about pg_dump and objects inherited from template1

From: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
To: Jan Wieck <janwieck(at)Yahoo(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unhappy thoughts about pg_dump and objects inherited from template1
Date: 2000-11-08 13:33:21
Message-ID: 3.0.5.32.20001109003321.02db18b0@mail.rhyme.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 |/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-11-08 15:00:37 Re: Issue NOTICE for attempt to raise lock level?
Previous Message Michael Meskes 2000-11-08 11:39:42 Re: USE OF CURSORS IN ECPG