Re: Generating TRUNCATE orders - Mailing list pgsql-general

From Florian Pflug
Subject Re: Generating TRUNCATE orders
Date
Msg-id 4704D46F.1070606@gmail.com
Whole thread Raw
In response to Re: Generating TRUNCATE orders  (Erik Jones <erik@myemma.com>)
List pgsql-general
Erik Jones wrote:
> On Oct 3, 2007, at 12:19 PM, Scott Marlowe wrote:
>
> SELECT 'TRUNCATE ' || schemaname || '.' || tablename ';'
> FROM pg_tables
> WHERE schemname='my_schema'
> ORDER BY tablename;

To be safe, you'd probably want to write
SELECT 'TRUNCATE' || quote_ident(schemaname) || '.' || quote_ident(tablename) ||
';' ...

Otherwise, table or schema names containing funny characters, upper case, or
spaces will cause trouble..

greetings, Florian Pflug


pgsql-general by date:

Previous
From: "Ashish Karalkar"
Date:
Subject: Re: multiple row insertion
Next
From: Miroslav Šulc
Date:
Subject: ERROR: variable not found in subplan target lists