pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Quinlan <trquinlan@home.com>
To: pgsql-admin@postgresql.org
Subject: Re: backup/restore
Date: Mon, 11 Sep 2000 19:26:56 -0400
Message-ID: <39BD6A40.67501463@home.com> (raw)
References: <20000908161320.C18742@axispt.com>
	<20000911095436.D13906@rice.edu>

This happens on Slackware as well.

"Ross J. Reedstrom" wrote:

> On Fri, Sep 08, 2000 at 04:13:20PM -0700, Lindell Alderman wrote:
> > I am trying to backup and restore a database, but when run the following:
> >
> > dropdb test
> > createdb test
> >
> > I find that the newly created database "test" is not empty but still has
> > all of the old relations and tables in it.  How do I destroy a database
> > so that it is truly gone!?!?!?  I need a totally clean databaes to restore
> > my data into.
>
> I'm going to put on my swami hat and read your mind now:
>
> Ah, your using Linux, specifically the Debian distribution, are you not?
>
> The problem is that psql by default connects to a database named the same
> as the unix username, except on Debian, where it defaults to connecting
> to the template1 database, since this is guaranteed to always exist. The
> primary purpose of template1 is to serve as a (surprise) template to
> build new databases on.
>
> What does this mean? Well, if you put anything in template1 (like install
> the pgpsql scipt language) it will, be default, be installed in all your
> new dbs.
>
> Unfortunately, if you accidently create tables in template1 (on Debian,
> just forgetting to put the db name in a psql command line will do it),
> they'll end up getting copied into every new db after that.
>
> So, connect to template1, and delete everything you don't want from there.
>
> Ross (learned from experience, I did)
> --
> Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
> NSBRI Research Scientist/Programmer
> Computer and Information Technology Institute
> Rice University, 6100 S. Main St.,  Houston, TX 77005




view thread (9+ messages)  latest in thread

Message-ID: <39BD6A40.67501463@home.com>
Permalink:  ../39BD6A40.67501463@home.com/
Also on:    postgresql.org/message-id/39BD6A40.67501463@home.com

 · 

reply

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: trquinlan@home.com
  Subject: Re: backup/restore
  In-Reply-To: <39BD6A40.67501463@home.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