Re: Fixing the loss of 'template1'

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org, martin(at)gregorie(dot)org
Subject: Re: Fixing the loss of 'template1'
Date: 2012-03-07 15:22:09
Message-ID: 201203070722.10035.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, March 07, 2012 6:23:42 am Martin Gregorie wrote:

> Question
> ========
> Is it possible to reinstate 'template1' and all its works without
> reinitialising the database from scratch. It was suggested to me that
> running "initdb" might fix it while leaving my data in place though my
> source was uncertain about its success. Would this work or is there a
> better way to restore 'template1' in a populated database system?

Was reading through this again and got to wondering, is pg_dumpall really
necessary? Do you have multiple databases you want to dump at once? If not a
plain pg_dump against a particular database would work. There is also the
advantage that if you use pg_dump -Fc you can use pg_restore. My use case for
pg_dumpall is pg_dumpall -g to get the global information only from the cluster.
I then use pg_dump for individual databases. You would still want to recreate a
template1 because quite a few tools expect it to be there.

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2012-03-07 15:32:19 Re: Fixing the loss of 'template1'
Previous Message Martin Gregorie 2012-03-07 15:19:51 Re: Fixing the loss of 'template1'