Re: truncate all tables?

From: Doug Bloebaum <blabes(at)gmail(dot)com>
To: Zlatko Matić <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: truncate all tables?
Date: 2005-06-29 14:20:32
Message-ID: caa2de8a0506290720153af755@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6/29/05, Zlatko Matić <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr> wrote:
>
> How could I truncate, delete all content of all tables in one step ?

You could use a query to generate the statements in psql:

\t
\o trunc_all.out

SELECT 'TRUNCATE ' || table_name || ';'
FROM information_schema.tables
WHERE table_schema='my_schema_name'
AND table_type='BASE TABLE';

\t
\o

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ketan S Shah 2005-06-29 14:24:47 how use pg_dump/pg_restore
Previous Message Matt Miller 2005-06-29 14:06:32 CVS Build - No Doc