Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9F788475F2F for ; Mon, 19 Aug 2002 22:43:48 -0400 (EDT) Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35]) by postgresql.org (Postfix) with ESMTP id 9B110475F3C for ; Mon, 19 Aug 2002 22:43:47 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g7K2hYH18264; Mon, 19 Aug 2002 22:43:34 -0400 (EDT) From: Bruce Momjian Message-Id: <200208200243.g7K2hYH18264@candle.pha.pa.us> Subject: Re: Temp tables In-Reply-To: <027901c247df$6c322560$3200a8c0@abartleypc> To: Andrew Bartley Date: Mon, 19 Aug 2002 22:43:34 -0400 (EDT) Cc: pgsql-general@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/838 X-Sequence-Number: 29183 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@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073