Re: Temporary tables inside functions problem - Mailing list pgsql-general

From Ian Barwick
Subject Re: Temporary tables inside functions problem
Date
Msg-id 200306082154.59758.barwick@gmx.net
Whole thread Raw
In response to Temporary tables inside functions problem  (Avi Schwartz <avi@CFFtechnologies.com>)
List pgsql-general
On Sunday 08 June 2003 01:50, Avi Schwartz wrote:
(...)
> It seems that the error occurs not when creating the temporary tables,
> but rather when attempting to insert into them.
>
> I am sure there is a logical explanation, although I can find it.  Any
> idea what is the problem and how I can fix it?

Possibly this item from the FAQ might help:
http://www.postgresql.org/docs/faqs/FAQ.html#4.26

4.26) Why can't I reliably create/drop temporary tables in PL/PgSQL functions?

PL/PgSQL caches function contents, and an unfortunate side effect is that if a
PL/PgSQL function accesses a temporary table, and that table is later dropped
and recreated, and the function called again, the function will fail because
the cached function contents still point to the old temporary table. The
solution is to use EXECUTE for temporary table access in PL/PgSQL. This will
cause the query to be reparsed every time.


Ian Barwick
barwick@gmx.net


pgsql-general by date:

Previous
From: Steve Lane
Date:
Subject: Re: Backups and restores.
Next
From: Arjen van der Meijden
Date:
Subject: Re: Linux 2.6 kernel,