Re: drop all tables in db - without dropdb ?!

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Tom Tom <luondor(at)yahoo(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: drop all tables in db - without dropdb ?!
Date: 2004-08-24 19:54:19
Message-ID: 200408241254.19075.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Tom tom,

> i would like to drop all tables in a database without
> having to issue individual drop-statements for every
> table.
> is there a command that can do this?

If you're usng 7.4, you can drop the public schema, which will drop all
objects in it:

DROP SCHEMA public CASCADE;

However, you may not have permission to do that either. In that case, no,
you're stuck with one-by-one dropping. I suggest either getting greater
permissions, or writing a quick script in Perl.

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2004-08-24 20:07:45 Re: drop all tables in db - without dropdb ?!
Previous Message michael 2004-08-24 19:48:58 Re: DATE column doesn't like empty string or null value