X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 61F4B4758F1 for ; Tue, 15 Apr 2003 17:36:30 -0400 (EDT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by postgresql.org (Postfix) with ESMTP id EDA5D474E44 for ; Tue, 15 Apr 2003 17:36:28 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id h3FLaIb10988; Tue, 15 Apr 2003 17:36:18 -0400 (EDT) From: Bruce Momjian Message-Id: <200304152136.h3FLaIb10988@candle.pha.pa.us> Subject: Re: SELECT INTO TEMP in Trigger? In-Reply-To: <878yugr89e.fsf@matt.w80.math-hat.com> To: Itai Zukerman Date: Tue, 15 Apr 2003 17:36:18 -0400 (EDT) Cc: pgsql-sql@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-Spam-Status: No, hits=-26.0 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/241 X-Sequence-Number: 12942 See the FAQ on creating temp objects in functions ... use EXECUTE. --------------------------------------------------------------------------- Itai Zukerman wrote: > > This seems to not be possible is plpgsql: > > > > SELECT DISTINCT A.x INTO TEMP X FROM A,B WHERE A.x=B.x; > > > > Is there some way to create a temporary table in plpgsql? > > Just to clarify, this sort-of works HOWEVER: > > SELECT count(*) FROM X; > DROP X; > > The first time through the plpgsql the SELECT is fine. Further times > it complains: > > ERROR: pg_class_aclcheck: relation 8845807 not found > > I guess it doesn't like dealing with a different X. Should I use > FOR-IN-EXECUTE? That seems ugly... > > -- > Itai Zukerman > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- 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