Recreate database but old tables still present

Started by gvimabout 15 years ago3 messagesgeneral
Jump to latest
#1gvim
gvimrc@gmail.com

PostgreSQL 9.0.3/Mac OS X 10.6.6

I need to recreate a database at regular intervals and what normally works is:

user$: dropdb -U myuser -h localhost mydb;

user $: psql -U myuser -h localhost mydb;
psql: FATAL: database "mydb" does not exist

user$: createdb -U myuser -h localhost mydb;

Now, for some reason, when I recreate the datbase the old tables are still present. I've tried the same procedure using a psql login but the result is the same.

gvim

#2Vibhor Kumar
vibhor.kumar@enterprisedb.com
In reply to: gvim (#1)
Re: Recreate database but old tables still present

On Feb 24, 2011, at 9:19 PM, gvim wrote:

Now, for some reason, when I recreate the datbase the old tables are still present. I've tried the same procedure using a psql login but the result is the same.

This can happen if template1 database has those tables. Check/verify if those tables are in template1 database.

Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
Cell: +91-932-568-2279
vibhor.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com

#3Guillaume Lelarge
guillaume@lelarge.info
In reply to: gvim (#1)
Re: Recreate database but old tables still present

Le 24/02/2011 16:49, gvim a �crit :

PostgreSQL 9.0.3/Mac OS X 10.6.6

I need to recreate a database at regular intervals and what normally
works is:

user$: dropdb -U myuser -h localhost mydb;

user $: psql -U myuser -h localhost mydb;
psql: FATAL: database "mydb" does not exist

user$: createdb -U myuser -h localhost mydb;

Now, for some reason, when I recreate the datbase the old tables are
still present. I've tried the same procedure using a psql login but the
result is the same.

You probably created your tables in the template1 database. Check this
database if they appear here too.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com