pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Josh Berkus <josh@agliodbs.com>
Cc: Thomas Good <tomg@admin.nrnet.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Cleaning up template 1 -> template0 cloning
Date: Wed, 03 Apr 2002 22:33:34 -0500
Message-ID: <20276.1017891214@sss.pgh.pa.us> (raw)
In-Reply-To: <web-847066@davinci.ethosmedia.com>
References: <web-847066@davinci.ethosmedia.com>

"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 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



view thread (4+ messages)

Message-ID: <20276.1017891214@sss.pgh.pa.us>
Permalink:  ../20276.1017891214@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20276.1017891214@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, josh@agliodbs.com, tomg@admin.nrnet.org
  Subject: Re: Cleaning up template 1 -> template0 cloning
  In-Reply-To: <20276.1017891214@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox