Обсуждение: DROPped database doesn't go away Postgres7.4

Поиск
Список
Период
Сортировка

DROPped database doesn't go away Postgres7.4

От
Joseph Sadove
Дата:
Hello All,

I cannot “re-create” a database properly.

I did a dump all of one database that runs on production.

I copied the dmp file to dev environment, DROPped the existing database, CREATEd
the database anew and then ran the dump in psql to recreate the database.

The database (and/or db server) seems all scrambled now.

The new database seems unchanged from the one I DROPped.

When I DROP it again and just re- CREATE it, without doing anything, all the
schemas and objects are there as if I never dropped it.

After I DROP the database, I check that it is indeed gone by trying to psql to
it. An error comes telling me the DB doesn’t exist.

This is extremely bizarre. Any help is vastly appreciated.


Thanks, Joe

The environment, etc. is:
RedHat ES3 (kernel 2.4.21)
Postgres 7.4.2-1 unclustered





--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi





Re: DROPped database doesn't go away Postgres7.4

От
Tom Lane
Дата:
Joseph Sadove <jsadove@beltion.net> writes:
> When I DROP it again and just re- CREATE it, without doing anything, all the
> schemas and objects are there as if I never dropped it.

It sounds to me like you have put a bunch of junk into the template1
database.  This was a bad move :-(.  What you can do as far as restoring
your old database goes is to create your new database using template0
instead of template1 as the source.  See
http://www.postgresql.org/docs/7.4/static/manage-ag-templatedbs.html

In the longer term, you might want to go back to a pristine template1.
It's possible to drop template1 and recreate it from template0, but
there are some gotchas to dodge.  Look up the detailed description
of how to do it at techdocs.postgresql.org --- I don't have the exact
URL at hand.

            regards, tom lane