From: | Erik Jones <erik(at)myemma(dot)com> |
---|---|
To: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
Cc: | "Laurent ROCHE" <laurent_roche(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Generating TRUNCATE orders |
Date: | 2007-10-03 18:16:48 |
Message-ID: | 3A530FB4-BD32-4E38-A9DE-D956997906A8@myemma.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Oct 3, 2007, at 12:19 PM, Scott Marlowe wrote:
> On 10/3/07, Laurent ROCHE <laurent_roche(at)yahoo(dot)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(at)myemma(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jimmy Choi | 2007-10-03 18:29:57 | Unexpected behavior with CASE statement |
Previous Message | Brian Wipf | 2007-10-03 18:16:23 | Re: PITR Recovery and out-of-sync indexes |