Re: "truncate all"? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: "truncate all"?
Date
Msg-id 22159.1060092981@sss.pgh.pa.us
Whole thread Raw
In response to Re: "truncate all"?  (Andreas <e9625203@student.tuwien.ac.at>)
List pgsql-hackers
Andreas <e9625203@student.tuwien.ac.at> writes:
> Agreed, workarounds are easy. The original suggestion of "TRUNCATE ALL"
> (or "TRUNCATE table CASCADE"), however, was motivated by the search for a
> simple and efficient truncation of all tables to accelerate unit-testing.

I still think the best suggestion for you is the one someone made
already: create a schema dump (pg_dump -s), then do DROP DATABASE,
CREATE DATABASE, load the schema dump.  This will be somewhat slower
than a hypothetical TRUNCATE ALL, but it has the great advantage that
your starting point is well-documented and guaranteed to be the same
on every iteration.  TRUNCATE ALL would provide no such guarantee.

And, of course, that solution exists today ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: DROP TYPE/DROP DOMAIN
Next
From: Tom Lane
Date:
Subject: Re: v7.4 Bundled ... please test ...