Re: Temporary Tables

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Roman Fail <rfail(at)posportal(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Temporary Tables
Date: 2003-04-02 01:01:14
Message-ID: 20030401165857.Y55556-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 1 Apr 2003, Roman Fail wrote:

> I've just written a function in PL/pgSQL that creates two temporary
> tables, then drops them at the end. For each session, the first time
> I run it works great. The second time I try it from the same session,
> I get this error:
>
> trans=# SELECT * FROM tranddthistory(6, '2003-03-20', '2003-04-05') AS
> (senddate date, day char(3), filename varchar(40), postingdate date,
> systemdate date) ;
> WARNING: Error occurred while executing PL/pgSQL function tranddthistory
> WARNING: line 19 at SQL statement
> ERROR: pg_class_aclcheck: relation 89979461 not found
> trans=#
>
> I feel pretty confident that I'm doing something wrong with the
> temporary tables. I've read everything I can find in the docs,
> searched the list archives, and come up empty. Any ideas?

You need to use execute to work with the temporary table. Otherwise,
it'll save the query plan which will be invalid after the drop/create.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-04-02 02:49:25 Re: Earth distance
Previous Message Roman Fail 2003-04-02 00:48:55 Temporary Tables