Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 1FF57474E42 for ; Wed, 3 Apr 2002 22:33:41 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id g343XZF20279; Wed, 3 Apr 2002 22:33:35 -0500 (EST) To: "Josh Berkus" Cc: Thomas Good , pgsql-sql@postgresql.org Subject: Re: Cleaning up template 1 -> template0 cloning In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Wed, 03 Apr 2002 17:45:35 -0800" Date: Wed, 03 Apr 2002 22:33:34 -0500 Message-ID: <20276.1017891214@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200204/46 X-Sequence-Number: 7311 "Josh Berkus" 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