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:10:31
Message-ID: 201203070710.31656.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?

So the question is, did you have your template1 customized in the 8.4
installation and are you looking to transfer those added items to the 9.1
installation? Some information on the template system can be found here:

http://www.postgresql.org/docs/9.1/interactive/manage-ag-templatedbs.html

As others have said you can recreate a bare template1 from template0. If you
had not customized template1 that should do. If you had customized it:

On the chance that the 8.4 cluster is still up and running you could just do a
pg_dump of template1 on that cluster and load it into the new cluster. If the
8.4 cluster is not running you can go to your pg_dumpall file and get the
template1 objects from there. Search for the \connect template1 string and look
for the SQL commands until the next \connect string.

>
>
> Martin

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-03-07 15:12:22 Re: ERROR: could not find tuple for trigger 37463634
Previous Message Andy Colson 2012-03-07 15:09:38 rounding a timestamp to nearest x seconds