Re: template0 and template1 databases - Mailing list pgsql-general

From Tom Lane
Subject Re: template0 and template1 databases
Date
Msg-id 3759.999805348@sss.pgh.pa.us
Whole thread Raw
In response to Re: template0 and template1 databases  (Andrew Gould <andrewgould@yahoo.com>)
Responses Re: template0 and template1 databases
List pgsql-general
Andrew Gould <andrewgould@yahoo.com> writes:
> Okay, so I don't need to pg_dump the template*
> databases; and I should not dropdb them.

template0 shouldn't need to be dumped, since it's always supposed to be
virgin initdb data.  template1 may need to be dumped if you have any
site-local additions in it.  pg_dumpall gets these considerations right.

As for dropping, the system won't let you do it unless you go in and
hand-hack pg_database's datistemplate flags.  I have actually tested
dropping template1 and recreating it from template0, which I suppose
someone might want to do if they mess up template1 badly enough.
If you drop template0, you no longer have a guaranteed virgin database
to use as a reference, but perhaps that doesn't bother you.

> My scripts aren't anything to brag about; but I think
> newbies (such as myself) may find them useful.  Who
> reviews contributions for /contrib?

Send 'em to pgsql-patches, I guess.

            regards, tom lane

pgsql-general by date:

Previous
From: Andrew Gould
Date:
Subject: Re: template0 and template1 databases
Next
From: "Ian Harding"
Date:
Subject: SQL Server to PostgreSQL HOWTO