Re: drop database / create database / data still here ? - Mailing list pgsql-admin

From Bruce Momjian
Subject Re: drop database / create database / data still here ?
Date
Msg-id 201004201525.o3KFP7p20556@momjian.us
Whole thread Raw
In response to drop database / create database / data still here ?  (Mitch Collinsworth <mitch@ccmr.cornell.edu>)
List pgsql-admin
Mitch Collinsworth wrote:
>
> Hi Folks,
>
> I thought I understood how this worked, but now it's baffling me.
> I want to drop a database named coral from my test server and load
> a fresh dump of it from my production server.  This has worked when
> I've done it before, but now it's giving me fits.  Here's an
> example:
>
> coral=# \c postgres
> You are now connected to database "postgres".
> postgres=# drop database coral;
> DROP DATABASE
> postgres=# create database coral;
> CREATE DATABASE
> postgres=# \c coral
> You are now connected to database "coral".
> coral=# \dt *.*

The problem is that you have created these tables in the 'template1'
database, and they are getting copied from there everytime you create a
new database.  FYI, you can also use another database as the template
database if you wish.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

pgsql-admin by date:

Previous
From: Jose Berardo
Date:
Subject: Re: PostgreSQL with SSL
Next
From: Bruce Momjian
Date:
Subject: Re: pg_restore -j