dbTalk Databases Forums  

DROP DATABASE, but still there

comp.databases.postgresql.general comp.databases.postgresql.general


Discuss DROP DATABASE, but still there in the comp.databases.postgresql.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Robert Fitzpatrick
 
Posts: n/a

Default DROP DATABASE, but still there - 11-11-2004 , 12:40 PM






What does it mean when you drop a database and then recreate with the
same name and all the objects are still there. I want to wipe out the db
and put back from pg_restore. After I re-create the db, all the old
tables are back before I run pg_restore.

--
Robert


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)


Reply With Quote
  #2  
Old   
Doug McNaught
 
Posts: n/a

Default Re: DROP DATABASE, but still there - 11-11-2004 , 01:03 PM






Robert Fitzpatrick <robert (AT) webtent (DOT) com> writes:

Quote:
What does it mean when you drop a database and then recreate with the
same name and all the objects are still there. I want to wipe out the db
and put back from pg_restore. After I re-create the db, all the old
tables are back before I run pg_restore.
Check the 'template1' database to see if the tables got put in there
by mistake at some point.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org



Reply With Quote
  #3  
Old   
Robert Fitzpatrick
 
Posts: n/a

Default Re: DROP DATABASE, but still there - 11-11-2004 , 01:17 PM



On Thu, 2004-11-11 at 14:03, Doug McNaught wrote:
Quote:
Robert Fitzpatrick <robert (AT) webtent (DOT) com> writes:

What does it mean when you drop a database and then recreate with the
same name and all the objects are still there. I want to wipe out the db
and put back from pg_restore. After I re-create the db, all the old
tables are back before I run pg_restore.

Check the 'template1' database to see if the tables got put in there
by mistake at some point.
Yeah, I was just starting to realize that these objects that keep coming
back are in the template1 as well.....any reason why I shouldn't drop
the template1 and re-create like any other?

--
Robert


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)



Reply With Quote
  #4  
Old   
Bruno Wolff III
 
Posts: n/a

Default Re: DROP DATABASE, but still there - 11-11-2004 , 02:10 PM



On Thu, Nov 11, 2004 at 14:17:45 -0500,
Robert Fitzpatrick <robert (AT) webtent (DOT) com> wrote:
Quote:
On Thu, 2004-11-11 at 14:03, Doug McNaught wrote:
Robert Fitzpatrick <robert (AT) webtent (DOT) com> writes:

What does it mean when you drop a database and then recreate with the
same name and all the objects are still there. I want to wipe out the db
and put back from pg_restore. After I re-create the db, all the old
tables are back before I run pg_restore.

Check the 'template1' database to see if the tables got put in there
by mistake at some point.

Yeah, I was just starting to realize that these objects that keep coming
back are in the template1 as well.....any reason why I shouldn't drop
the template1 and re-create like any other?
I think you need to use the -T option if you do this to have a copy made
of template0 instead of the default of template1.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html



Reply With Quote
  #5  
Old   
Greg Stark
 
Posts: n/a

Default Re: DROP DATABASE, but still there - 11-11-2004 , 02:17 PM




Robert Fitzpatrick <robert (AT) webtent (DOT) com> writes:

Quote:
Yeah, I was just starting to realize that these objects that keep coming
back are in the template1 as well.....any reason why I shouldn't drop
the template1 and re-create like any other?
You can do that but you'll have to do:

CREATE DATABASE template1 WITH template = 'template0'


--
greg


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



Reply With Quote
  #6  
Old   
Tom Lane
 
Posts: n/a

Default Re: DROP DATABASE, but still there - 11-11-2004 , 03:14 PM



Greg Stark <gsstark (AT) mit (DOT) edu> writes:
Quote:
Robert Fitzpatrick <robert (AT) webtent (DOT) com> writes:
Yeah, I was just starting to realize that these objects that keep coming
back are in the template1 as well.....any reason why I shouldn't drop
the template1 and re-create like any other?

You can do that but you'll have to do:
CREATE DATABASE template1 WITH template = 'template0'
Also there are several safety interlocks you'll have to defeat, IIRC.
It's not rocket science but I'd recommend consulting the writeup on
techdocs.postgresql.org about the exact process for recreating
template1.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.