Re: Cleaning up template 1 -> template0 cloning

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Cleaning up template 1 -> template0 cloning
Дата
Msg-id 20276.1017891214@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Cleaning up template 1 -> template0 cloning  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-sql
"Josh Berkus" <josh@agliodbs.com> writes:
> Trying to remove template1 to restore it using an undamaged template0
>  seems to be a catch-22 with no way out.  Help!

There are defenses in place that are intended to prevent you from
accidentally shooting yourself in the foot.  Quoting from the source:
    * Disallow dropping a DB that is marked istemplate.  This is just to    * prevent people from accidentally dropping
template0or template1;    * they can do so if they're really determined ...
 

Offhand I think you have to (a) make sure you have a spare database
available to issue the DROP DATABASE from, and (b) clear the
datistemplate flag from template1's pg_database row.

("Ensign, engage primary destructor beam" ... "Engaged" ... "Fire!")

After you recreate a fresh template1 you should of course set
datistemplate for it, else non-superusers will have difficulty
creating new databases.
        regards, tom lane


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

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: Cleaning up template 1 -> template0 cloning
Следующее
От: Iklódi Lajos
Дата:
Сообщение: Re: Update in trigger