Re: Using Temporary Tables in postgres functions - Mailing list pgsql-sql

From Andrew Sullivan
Subject Re: Using Temporary Tables in postgres functions
Date
Msg-id 20070125160038.GB16529@phlogiston.dyndns.org
Whole thread Raw
In response to Using Temporary Tables in postgres functions  (Mario Splivalo <mario.splivalo@mobart.hr>)
Responses Re: Using Temporary Tables in postgres functions
List pgsql-sql
On Thu, Jan 25, 2007 at 03:39:14PM +0100, Mario Splivalo wrote:
> When I try to use TEMPORARY TABLE within postgres functions (using 'sql'
> as a function language), I can't because postgres can't find that
> temporary table. Consider this example:

You need to build the temp table and EXECUTE the statement.  The
problem is that the plan is cached for later re-use.  Since the
cached plan has the id of a table that no longer exists, you get this
error.  See the PL/pgSQL part of the manual for more on this.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
Unfortunately reformatting the Internet is a little more painful 
than reformatting your hard drive when it gets out of whack.    --Scott Morris


pgsql-sql by date:

Previous
From: Mario Splivalo
Date:
Subject: Using Temporary Tables in postgres functions
Next
From: Stephan Szabo
Date:
Subject: Re: Using Temporary Tables in postgres functions