Re: Using Temporary Tables in postgres functions

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Using Temporary Tables in postgres functions
Date: 2007-01-25 16:00:38
Message-ID: 20070125160038.GB16529@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)crankycanuck(dot)ca
Unfortunately reformatting the Internet is a little more painful
than reformatting your hard drive when it gets out of whack.
--Scott Morris

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2007-01-25 16:03:51 Re: Using Temporary Tables in postgres functions
Previous Message Mario Splivalo 2007-01-25 14:39:14 Using Temporary Tables in postgres functions