From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | "Lenorovitz, Joel" <Joel(dot)Lenorovitz(at)usap(dot)gov> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Temp Table Within PLPGSQL Function - Something Awry |
Date: | 2007-01-16 18:18:09 |
Message-ID: | 20070116181809.GJ8182@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Jan 16, 2007 at 11:10:25AM -0700, Lenorovitz, Joel wrote:
> Greetings,
>
> I am trying to work with a TEMP TABLE within a plpgsql function and I
> was wondering if anyone can explain why the function below, which is
> fine syntactically, will work as expected the first time it is called,
> but will err out as shown on subsequent calls.
Known problem, I beleive it's even mentioned in the docs.
Basically, if you use temp tables in pl/pgsql, you have to use EXECUTE
for the statements referring to it. The issue is that pl/pgsql is
caching the plan and so tries to use the plan with the old temp table
after the table has gone.
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.
From | Date | Subject | |
---|---|---|---|
Next Message | Alan Hodgson | 2007-01-16 18:22:42 | Re: Temp Table Within PLPGSQL Function - Something Awry |
Previous Message | Ed L. | 2007-01-16 18:13:00 | lock query |