X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 29E6D47633A for ; Fri, 11 Apr 2003 18:15:08 -0400 (EDT) Received: from nycsmtp5out-eri0.rdc-nyc.rr.com (nycsmtp5out-eri0.rdc-nyc.rr.com [24.29.99.228]) by postgresql.org (Postfix) with ESMTP id 4BA0B476323 for ; Fri, 11 Apr 2003 18:15:07 -0400 (EDT) Received: from math-hat.com (66-65-68-41.nyc.rr.com [66.65.68.41]) by nycsmtp5out-eri0.rdc-nyc.rr.com (8.12.1/Road Runner SMTP Server 1.0) with SMTP id h3BM5LwL026559 for ; Fri, 11 Apr 2003 18:05:21 -0400 (EDT) Received: (nullmailer pid 23281 invoked by uid 1000); Fri, 11 Apr 2003 22:15:09 -0000 To: pgsql-sql@postgresql.org Subject: Re: SELECT INTO TEMP in Trigger? Mail-Copies-To: never From: Itai Zukerman Date: Fri, 11 Apr 2003 18:15:09 -0400 In-Reply-To: <87brzcr8pf.fsf_-_@matt.w80.math-hat.com> (Itai Zukerman's message of "Fri, 11 Apr 2003 18:05:32 -0400") Message-ID: <878yugr89e.fsf@matt.w80.math-hat.com> User-Agent: Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.2 (gnu/linux) References: <874r54sr8q.fsf@matt.w80.math-hat.com> <87smsora9b.fsf@matt.w80.math-hat.com> <87brzcr8pf.fsf_-_@matt.w80.math-hat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Status: No, hits=-21.2 required=5.0 tests=BAYES_10,IN_REP_TO,REFERENCES,UPPERCASE_25_50, USER_AGENT_GNUS_UA 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/193 X-Sequence-Number: 12894 > 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