Re: Generating TRUNCATE orders - Mailing list pgsql-general

From Erik Jones
Subject Re: Generating TRUNCATE orders
Date
Msg-id 3A530FB4-BD32-4E38-A9DE-D956997906A8@myemma.com
Whole thread Raw
In response to Re: Generating TRUNCATE orders  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Responses Re: Generating TRUNCATE orders
List pgsql-general
On Oct 3, 2007, at 12:19 PM, Scott Marlowe wrote:

> On 10/3/07, Laurent ROCHE <laurent_roche@yahoo.com> wrote:
>
> Would this work:
>
> SELECT
> 'TRUNCATE TABLE ' ||
> 'my_schema.' ||
> c.relname ||', '
> FROM pg_namespace nc, pg_class c
>   WHERE c.relnamespace = nc.oid
> AND  c.relkind IN ('r' )
> AND nc.nspname = 'my_schema'
> ORDER BY relname

Or, just:

SELECT 'TRUNCATE ' || schemaname || '.' || tablename ';'
FROM pg_tables
WHERE schemname='my_schema'
ORDER BY tablename;

Erik Jones

Software Developer | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com



pgsql-general by date:

Previous
From: Brian Wipf
Date:
Subject: Re: PITR Recovery and out-of-sync indexes
Next
From: Tom Lane
Date:
Subject: Re: PITR Recovery and out-of-sync indexes