Re: drop all tables in db - without dropdb ?! - Mailing list pgsql-novice

From Josh Berkus
Subject Re: drop all tables in db - without dropdb ?!
Date
Msg-id 200408241254.19075.josh@agliodbs.com
Whole thread Raw
In response to drop all tables in db - without dropdb ?!  (Tom Tom <luondor@yahoo.com>)
List 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

pgsql-novice by date:

Previous
From: michael@floog.net
Date:
Subject: Re: DATE column doesn't like empty string or null value
Next
From: Oliver Elphick
Date:
Subject: Re: drop all tables in db - without dropdb ?!