Re: Fixing the loss of 'template1'

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: Fixing the loss of 'template1'
Дата
Msg-id CABRT9RA1Ag+d=Tb-865gzNMmAdgMT1UAifGvy_SB_sE9AeX29A@mail.gmail.com
обсуждение исходный текст
Ответ на Fixing the loss of 'template1'  (Martin Gregorie <martin@gregorie.org>)
Ответы Re: Fixing the loss of 'template1'  (Gary Chambers <gwchamb@gwcmail.com>)
Re: Fixing the loss of 'template1'  (Steve Clark <sclark@netwolves.com>)
Список pgsql-general
On Wed, Mar 7, 2012 at 16:23, Martin Gregorie <martin@gregorie.org> wrote:
> 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?

You can always re-create template1 from template0:

CREATE DATABASE template1 WITH TEMPLATE template0;

> In the course of migrating from (I think) Postgres 8.4 under Fedora 12
> to Postgres 9.1 under Fedora 16 I managed to loose 'template1' and
> associated data.

As far as I can tell, the only way to remove the template1 database is
to rename it. Maybe that's what happened. This query should tell you
the name of the database that used to be template1:

SELECT datname FROM pg_database WHERE datistemplate;

Regards,
Marti

В списке pgsql-general по дате отправления:

Предыдущее
От: Gary Chambers
Дата:
Сообщение: Re: Fixing the loss of 'template1'
Следующее
От: Gary Chambers
Дата:
Сообщение: Re: Fixing the loss of 'template1'