pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: Using Temporary Tables in postgres functions
Date: Thu, 25 Jan 2007 11:00:38 -0500
Message-ID: <20070125160038.GB16529@phlogiston.dyndns.org> (raw)
In-Reply-To: <1169735954.31872.38.camel@localhost.localdomain>
References: <1169735954.31872.38.camel@localhost.localdomain>

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



view thread (8+ messages)  latest in thread

Message-ID: <20070125160038.GB16529@phlogiston.dyndns.org>
Permalink:  ../20070125160038.GB16529@phlogiston.dyndns.org/
Also on:    postgresql.org/message-id/20070125160038.GB16529@phlogiston.dyndns.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ajs@crankycanuck.ca
  Subject: Re: Using Temporary Tables in postgres functions
  In-Reply-To: <20070125160038.GB16529@phlogiston.dyndns.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox