Re: Cleaning up template 1 -> template0 cloning

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: Thomas Good <tomg(at)admin(dot)nrnet(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Cleaning up template 1 -> template0 cloning
Date: 2002-04-04 03:33:34
Message-ID: 20276.1017891214@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Josh Berkus" <josh(at)agliodbs(dot)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 template0 or 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Iklódi Lajos 2002-04-04 03:41:22 Re: Update in trigger
Previous Message Josh Berkus 2002-04-04 01:58:28 Re: Cleaning up template 1 -> template0 cloning