Re: Bug #913: plpgsql function fails on second call

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <jbduffy(at)ntlworld(dot)com>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bug #913: plpgsql function fails on second call
Date: 2003-03-18 18:30:09
Message-ID: 20030318102844.U40313-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Tue, 18 Mar 2003 pgsql-bugs(at)postgresql(dot)org wrote:

> create temp table ab as
> select a.value as a_value, b.value as b_value
> from a left outer join b
> on a.id = b.id;
>
> for row in select * from ab loop
> return next row;
> end loop;
>
> drop table ab;

If you're going to be doing create/drop table, you need to use
EXECUTE on the queries relating to the table, otherwise it'll cache
the plan which is invalid on the second pass since the table being
referenced is gone (replaced by a new ab table).

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ninonard Policarpio 2003-03-19 01:58:24 Bugs or Error?
Previous Message Bruce Momjian 2003-03-18 17:31:04 Re: Bug #913: plpgsql function fails on second call