Re: use of temporary tables in functions

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Administrator <admin(at)odyssey(dot)co(dot)in>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: use of temporary tables in functions
Date: 2002-04-17 16:30:39
Message-ID: 20020417092906.G62182-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 17 Apr 2002, Administrator wrote:

> Hi,
>
> While using a temporary table in a function, it seems that after
> dropping the table it stays in the functions cache.
>
> create function tmp_fn() returns integer as'
> begin
> create temporary table test(id integer primary key, x_val integer);
> insert into test (id, x_val) values(1,2);
> drop table test;
> return 1;
> end;'
> language 'plpgsql';
>
> The next time it comes back with a message "Relation 128863 does not
> exist". How can we avoid the oid of the table from being left in the
> cache?

When using temporary tables from functions, you'll currently need to use
EXECUTE to run all the queries on that table (in this case, all of your
queries) as a workaround.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message noy 2002-04-17 16:34:49 Re: Date precision problem
Previous Message Randall Perry 2002-04-17 16:16:35 Re: Update with data from table creates random input