From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | jws <jsacksteder(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: temp tables in functions? |
Date: | 2007-02-08 05:49:11 |
Message-ID: | 20070208054911.GA26050@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Feb 07, 2007 at 20:40:09 -0800,
jws <jsacksteder(at)gmail(dot)com> wrote:
> Having developed a complex query, I want to wrap it up as a function
> so that it can take a parameter and return a set of rows. This query
> is currently written as multiple sql statements that create a few
> interstitial temp tables that are then joined. If I put this into a
> function definition, do those temp tables get dropped automatically
> when the function returns?
See: http://www.postgresql.org/docs/8.2/interactive/sql-createtable.html
So, the answer is no.
Also note that currently Postgres will cache information about tables
used in functions and this may not work well when you are dropping and
recreating tables with the same name in the same session. For that kind
of thing you need to use EXECUTE to avoid caching.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-02-08 05:57:14 | Re: Database corruption. |
Previous Message | roopa perumalraja | 2007-02-08 05:17:56 | Re: Storing database in cluster (Memory) |