Thread: Reloading Template1

Reloading Template1

From
Hadley Willan
Date:
Hello,
    I've accidently created a whole bunch of tables and sequences in template1.

I didn't actually want the information in template1 but with the slip of a key my script piped all the commands into it and now all the info is there, doh!.

Problem is now that I try to create the DB I want, all the view and structures are already there.

How to I recreate an empty template1?

Thanks
--
Hadley Willan » Director » hadley.willan@deeperdesign.com » +64(21) 28 41 463
Deeper Design Limited » +64(7) 377 3328 » www.deeperdesign.com

Re: Reloading Template1

From
"V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Date:
Dear Hadley Willan  ,

Read This
http://techdocs.postgresql.org/redir.php?link=/techdocs/pgsqladventuresep1.php



-- 
Regards,
Vishal Kashyap

~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
I Know you believe my words so logon to Jabber.org
and add vishalkashyap@jabber.org to your roster.                    OR
Seek Me at 264360076                                 
~*~*~*~*~*~*~*~*
I am usually called as Vishal Kashyap
but my Girlfriend calls me as Vishal CASH UP.
This is because others identify me because of my generosity
but my Girlfriend identify me because of my CASH.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

Re: Reloading Template1

From
"V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Date:
Dear Hadley Willan  ,

Read This
http://techdocs.postgresql.org/redir.php?link=/techdocs/pgsqladventuresep1.php



-- 
Regards,
Vishal Kashyap

~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
I Know you believe my words so logon to Jabber.org
and add vishalkashyap@jabber.org to your roster.                    OR
Seek Me at 264360076                                 
~*~*~*~*~*~*~*~*
I am usually called as Vishal Kashyap
but my Girlfriend calls me as Vishal CASH UP.
This is because others identify me because of my generosity
but my Girlfriend identify me because of my CASH.
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

Re: Reloading Template1

From
Richard Huxton
Date:
On Tuesday 27 January 2004 08:13, Hadley Willan wrote:
> Hello,
>     I've accidently created a whole bunch of tables and sequences in
> template1.
>
> I didn't actually want the information in template1 but with the slip of
> a key my script piped all the commands into it and now all the info is
> there, doh!.

We all have doh! moments, you are not the first to be here.

> How to I recreate an empty template1?

Two options:
1. Manually undo all the changes (no, didn't think you liked that one)
2. Drop template1 and recreate it using template0

The createdb command has a flag to let you base your new database on something
other than template1. Actually, IIRC this is exactly why we have template0 -
for those occasions where you want to regenerate template1.

--
  Richard Huxton
  Archonet Ltd

Re: Reloading Template1

From
Tom Lane
Date:
Richard Huxton <dev@archonet.com> writes:
> Actually, IIRC this is exactly why we have template0 -
> for those occasions where you want to regenerate template1.

Well, that's one of its uses.

IIRC there is a page on techdocs.postgresql.org that will walk you
through this procedure.  There are a couple of safety interlocks you
need to defeat temporarily, so it's a bit more than a DROP and a CREATE.

            regards, tom lane

Re: Reloading Template1

From
Hadley Willan
Date:
Thanks everybody for your help.

It was a pretty simple procedure at the end of the day and I've learned a valuable lesson, remember which DB its all going to!

Thanks again.

Hadley

On Wed, 2004-01-28 at 10:13, Hadley Willan wrote:
Hello,
    I've accidently created a whole bunch of tables and sequences in template1.

I didn't actually want the information in template1 but with the slip of a key my script piped all the commands into it and now all the info is there, doh!.

Problem is now that I try to create the DB I want, all the view and structures are already there.

How to I recreate an empty template1?

Thanks