Re: Deleting data bases and tables?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Cima <ruel(dot)cima(at)facinf(dot)uho(dot)edu(dot)cu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Deleting data bases and tables?
Date: 2005-03-23 06:37:21
Message-ID: 20050323063721.GA39128@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Mar 23, 2005 at 02:05:12AM -0500, Cima wrote:
>
> i created a database and ran an sql script to create some tables.
> later i deleted the tables and later the data base itself. when i
> created a new database i noticed that the tables from the previous non
> related database appeared in this new database.

Have you created tables in the default template database (template1)?
If so, then those tables will be copied to newly-created databases.
See "Template Databases" in the "Managing Databases" chapter of the
documentation:

http://www.postgresql.org/docs/8.0/static/manage-ag-templatedbs.html

> i ran another sql script to create more tables and the new tables
> didnt appear immediately, i had to restart the postmaster and then
> the new tbles with the other tables appeared

This sounds odd -- are you sure you've analyzed the situation
correctly? Can you provide an exact sequence of steps that
demonstrates this behavior?

> so im wondering if im not going about the deleting procedure the
> right way. what can or should i do to stop the old table from
> reappearing in my new databases?

I'd guess that you've been working in the template1 database, so
when you create a new database it gets a copy of the tables in
template1. In general you should leave template1 alone and create
other databases for doing work.

Do you see this problem if you use template0 as the database template?
See the createdb or CREATE DATABASE documentation for instructions
on how to do that.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Rajarshi Mukherjee 2005-03-23 06:39:33 grant problem
Previous Message Tim Bowden 2005-03-23 03:15:17 Re: Compiling 8.0.1 on Ubuntu AMD_64