Re: V7.4.2: drop database does not drop schemas/table/data

Lists: pgsql-bugs
From: Rachel Willmer <rachel(at)willmer(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: V7.4.2: drop database does not drop schemas/table/data
Date: 2004-05-11 11:14:04
Message-ID: 40A0B57C.6010300@willmer.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

I have a database 'testdb' with two schemas: 'public' and edinburgh'.
Public is empty, everything is in 'edinburgh'.

DROP DATABASE testdb;

Database no longer appears in list of databases in cluster. So far, so good.

CREATE DATABASE testdb;

Database appears again. But so does the schema 'edinburgh', all its
tables, views, data, etc.

From reading the documentation, I thought that "DROP DATABASE" also
deleted all the underlying objects. In which case, this is a bug.

BTW, this is my first post of a postgresql bug. It would be useful if
your page
<http://www.postgresql.org/docs/current/static/bug-reporting.html> had a
link to where the "TODO LIST" and "FAQ" files can be found - it's not
obvious unless you already know!

Thanks
Rachel

PS: System is PostgreSQL 7.4.2 on i686-pc-linux-gnu, compiled by GCC gcc
(GCC) 3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3-3-7)


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Rachel Willmer <rachel(at)willmer(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: V7.4.2: drop database does not drop schemas/table/data
Date: 2004-05-11 19:36:57
Message-ID: 12423.1084304217@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Rachel Willmer <rachel(at)willmer(dot)com> writes:
> DROP DATABASE testdb;
> CREATE DATABASE testdb;

> Database appears again. But so does the schema 'edinburgh', all its
> tables, views, data, etc.

Sounds like you created all that stuff in template1, and so it's being
copied into the new database. Read about template databases:
http://www.postgresql.org/docs/7.4/static/manage-ag-templatedbs.html

If you decide you want to rebuild template1 without re-initdb'ing,
there's a recipe somewhere on the techdocs site --- it's not quite
a trivial thing to do.

regards, tom lane


From: Rachel Willmer <rachel(at)willmer(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: V7.4.2: drop database does not drop schemas/table/data
Date: 2004-05-12 08:50:12
Message-ID: 40A1E544.4040305@willmer.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:

> Sounds like you created all that stuff in template1, and so it's being
> copied into the new database.

Yup, that's it. Thanks!
Rachel