Skip site navigation (1) Skip section navigation (2)

Re: EMPTYING A DATABASE

From: "George Weaver" <gweaver(at)shaw(dot)ca>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: EMPTYING A DATABASE
Date: 2010-04-29 18:21:06
Message-ID: 2E9071DB49174ACCB4E0C1AEF5BC758F@d800 (view raw or flat)
Thread:
Lists: pgsql-novice
> From: "Tom Lane":

> That's only going to be convenient if the OP periodically wants to
> return to exactly the same database state.  If he's doing database
> development, it's probably going to be more like he periodically
> changes the schema and then wants to start over.  I suppose he could
> try to remember to apply his schema changes in the template database
> and then clone it, but that seems pretty error-prone.
> 
 > My thought would be to make use of multi-table TRUNCATE, assuming
> he's using a PG version new enough to have that.  Keep a script
> around with a TRUNCATE that lists all of the related tables in one
> command, and just run the script to reset.

Wouldn't using pg_dump with the schema only option accomplish this?

George

In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2010-04-29 18:56:35
Subject: Re: EMPTYING A DATABASE
Previous:From: Tom LaneDate: 2010-04-29 16:43:59
Subject: Re: EMPTYING A DATABASE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group