| From: | Bruce Momjian <bruce(at)momjian(dot)us> | 
|---|---|
| To: | Mitch Collinsworth <mitch(at)ccmr(dot)cornell(dot)edu> | 
| Cc: | pgsql-admin(at)postgresql(dot)org | 
| Subject: | Re: drop database / create database / data still here ? | 
| Date: | 2010-04-20 15:25:07 | 
| Message-ID: | 201004201525.o3KFP7p20556@momjian.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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(at)momjian(dot)us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2010-04-20 15:26:21 | Re: pg_restore -j | 
| Previous Message | Tom Lane | 2010-04-20 14:58:10 | Re: How to disconnect a single user in Postgresql 8.2.5 from a database |