From: Scott Marlowe <scott.marlowe@gmail.com>
To: Mitch Collinsworth <mitch@ccmr.cornell.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: drop database / create database / data still here ?
Date: Tue, 20 Apr 2010 10:25:41 -0600
Message-ID: <p2mdcc563d11004200925pabd157f5jcd3d04c2fa74813b@mail.gmail.com> (raw)
In-Reply-To: <p2rdcc563d11004200906rbb042267udd9eae424ff76085@mail.gmail.com>
References: <Pine.LNX.4.62.1004131409580.4362@siamese.ccmr.cornell.edu>
<p2rdcc563d11004200906rbb042267udd9eae424ff76085@mail.gmail.com>
On Tue, Apr 20, 2010 at 10:06 AM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
> On Tue, Apr 13, 2010 at 12:16 PM, Mitch Collinsworth
> <mitch@ccmr.cornell.edu> 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 *.*
>> List of relations
>> Schema | Name | Type | Owner
>> --------------------+--------------------------------+-------+----------
>> accmgr | acct_rate | table | accmgr
>> accmgr | acct_rate_working | table | accmgr
>> accmgr | acct_sum | table | accmgr
>> accmgr | acct_sum_raw | table | accmgr
>
> I'm pretty sure that at some time you accidentally created those
> tables in template1 and now you're getting them every time you create
> a database. Clean out template1 and things should be ok.
Note that if you have thousands of objects in template1, you can drop
it and recreate it from template0 like so:
update pg_database set datistemplate=false where datname='template1';
drop database template1;
create database template1 with template template0;
update pg_database set datistemplate=true where datname='template1';
\c template1
vacuum freeze;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: scott.marlowe@gmail.com, mitch@ccmr.cornell.edu
Subject: Re: drop database / create database / data still here ?
In-Reply-To: <p2mdcc563d11004200925pabd157f5jcd3d04c2fa74813b@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox