Re: Temp tables

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Bartley <abartley(at)evolvosystems(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Temp tables
Date: 2002-08-20 02:43:34
Message-ID: 200208200243.g7K2hYH18264@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrew Bartley wrote:
> Hi all,
>
> Can someone tell me what the difference is in a plpgsql function
> between dropping a temp table at the end of a function and not
> dropping the temp tables.
>
> What other tables does it have an effect on?
>
> It appears there is some overhead when the drop is being executed.
>
> Is there some simple doco I can read to clue me up on the process?

You can drop it whenever you want. If not, it drops on session exit.

On issue with plpgsql is that when you create a temp table in a function
and drop it, then call the function again, it still think the original
temp table exists. You need to use EXECUTE in plpgsql if you want to
drop/create temp tables multiple times in the same session.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

  • Temp tables at 2002-08-20 00:20:13 from Andrew Bartley

Browse pgsql-general by date

  From Date Subject
Next Message Jules Alberts 2002-08-20 06:43:44 Re: Updating a date field
Previous Message Tom Lane 2002-08-20 02:37:28 Re: Functions question