Hmm, true. So I guess the real solution (once temp tables work nicely)
would be something like CREATE LOCAL TEMP TABLE where the pl/pgsql
parser invents the unusual name for you. Ofcourse, then you run into
the issue where subcalls (like using EXECUTE) won't be able to see that
table either.
What you want is lexical scoping between the pl/pgsql and the backend,
which is not really possible in the current system.
Have a nice day,
On Thu, Jul 21, 2005 at 08:12:11AM -0700, Stephan Szabo wrote:
> On Thu, 21 Jul 2005, Martijn van Oosterhout wrote:
>
> > On Thu, Jul 21, 2005 at 07:10:03PM +1000, Ezequiel Tolnay wrote:
> > > * Create a ROWSET variable type in plpgsql that would function like a
> > > temporary but in-memory table. Support for it would have to be added for
> > > plpgsql's SELECT, UPDATE and DELETE statements.
> >
> > How is this different from a temporary table?
>
> I'd expect they'd scope "correctly" in cases of recursive calls and the
> like. So, if the recursive call wanted its own, it wouldn't have to try to
> find an unused temporary table name. Offhand, I'm not sure if that'd
> really be useful in practice once temporary tables in plpgsql didn't
> require one to jump through hoops, but it has some niceness.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.