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