From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Godshall Michael <Michael_Godshall(at)gmachs(dot)com> |
Cc: | "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Possible to create table name with a variable? Temp |
Date: | 2003-08-22 23:13:30 |
Message-ID: | 20030822160825.G98413-100000@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Fri, 22 Aug 2003, Godshall Michael wrote:
You probably need to use EXECUTE.
EXECUTE ''DROP TABLE '' || random_table_name;
...
EXECUTE ''CREATE TABLE '' || random_table_name || ...
or
EXECUTE ''CREATE TEMP TABLE '' || random_table_name || ...
If you want to use the table from another function,
I think you'll probably need to wrap the uses of it
with EXECUTE in those functions as well. Or you might
be better off in another pl language (maybe pltcl or
plpython) because plpgsql caches the query plans and
gets somewhat confused when tables not used in EXECUTE
are dropped between calls.
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Johnson | 2003-08-23 14:41:48 | Re: Clusters and pgsql |
Previous Message | Godshall Michael | 2003-08-22 23:01:47 | Possible to create table name with a variable? Temp tables? |