| From: | Florian Pflug <fgp(dot)phlo(dot)org(at)gmail(dot)com> |
|---|---|
| To: | Erik Jones <erik(at)myemma(dot)com> |
| Cc: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Laurent ROCHE <laurent_roche(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Generating TRUNCATE orders |
| Date: | 2007-10-04 11:54:23 |
| Message-ID: | 4704D46F.1070606@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Miroslav Šulc | 2007-10-04 12:00:39 | ERROR: variable not found in subplan target lists |
| Previous Message | Ashish Karalkar | 2007-10-04 11:42:33 | Re: multiple row insertion |