Re: Bug #913: plpgsql function fails on second call - Mailing list pgsql-bugs

From Stephan Szabo
Subject Re: Bug #913: plpgsql function fails on second call
Date
Msg-id 20030318102844.U40313-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Bug #913: plpgsql function fails on second call  (pgsql-bugs@postgresql.org)
List pgsql-bugs
On Tue, 18 Mar 2003 pgsql-bugs@postgresql.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).

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Bug #913: plpgsql function fails on second call
Next
From: Sean Reifschneider
Date:
Subject: Re: Problem with RULE to update tables