Re: temporary tables, plpgsql and yes i bet this has been asked

From: Jan Wieck <janwieck(at)yahoo(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Murray Prior Hobbs <murray(at)efone(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: temporary tables, plpgsql and yes i bet this has been asked
Date: 2002-02-04 20:06:26
Message-ID: 200202042006.g14K6QR01773@saturn.janwieck.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Bruce Momjian wrote:
> Murray Prior Hobbs wrote:
> >
> > in a plpgsql function
> >
> > create temporary table X
> >
> > ....
> >
> >
> > drop table X
> >
> >
> > then in another function
> >
> > loop
> >
> > call the other function
> >
> > end loop
> >
> >
> > i get the problem that the second time the table is created (ie in the
> > second call) it is not visible
> >
> > now yes i could declare the table in the calling funtion but then the
> > original function is less useful to me
>
> Interesting. Can you recreate the problem in psql without the functions
> and show an example? I am confused how this could be failing.

I bet he's using the temp table without EXECUTE. That
would've failed even without the other "calling" function
around it, as soon as he uses it more than once per session.

SPI still needs to learn how to determine if a query uses
temp tables somewhere in order to silently re-prepare queries
when required. And I am absolutely sure this is not an issue
we should address in PL/pgSQL. It has to be solved on the SPI
level.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2002-02-04 20:15:30 Re: temporary tables, plpgsql and yes i bet this has been asked
Previous Message Tom Lane 2002-02-04 15:47:05 Re: temporary tables, plpgsql and yes i bet this has been asked before