Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DFA4E632710 for ; Fri, 9 Apr 2010 14:24:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 78703-07 for ; Fri, 9 Apr 2010 17:24:29 +0000 (UTC) X-Greylist: delayed 00:05:46.749425 by SQLgrey-1.7.6 Received: from mail.jfcomputer.com (unknown [76.14.161.106]) by mail.postgresql.org (Postfix) with ESMTP id 663A06324E2 for ; Fri, 9 Apr 2010 14:24:29 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.jfcomputer.com (Postfix) with ESMTP id 6C03177BE5 for ; Fri, 9 Apr 2010 10:18:40 -0700 (PDT) X-Virus-Scanned: amavisd-new at jfcomputer.com Received: from mail.jfcomputer.com ([127.0.0.1]) by localhost (server1.jfcomputer.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L2k1mWRoZhSh for ; Fri, 9 Apr 2010 10:18:38 -0700 (PDT) Received: from [192.168.1.219] (unknown [192.168.1.219]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johnf@mail.jfcomputer.com) by mail.jfcomputer.com (Postfix) with ESMTPSA id 4C83B78124 for ; Fri, 9 Apr 2010 10:18:38 -0700 (PDT) From: John To: pgsql-sql@postgresql.org Subject: understanding select into Date: Fri, 9 Apr 2010 10:18:37 -0700 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201004091018.37965.johnf@jfcomputer.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.274 tagged_above=-10 required=5 tests=RDNS_NONE=1.274 X-Spam-Level: * X-Archive-Number: 201004/37 X-Sequence-Number: 33964 Hi, I am reviewing a function written by some xTuple guys. What is interesting about it is it uses the "INTO" statement like select something into _p from sometable where somecriteria. The function contiunes and uses the data retreived _p.somefield_name And then the function ends. Ok my question: I also thought the select "into" created a real table. But after running the function the table does not exist. I see no where that a 'drop' is issued. In fact the function uses lot's of select into's like (_test, _r, etc..). So would some kind soul explain what is happening. Could it be that "_p" is drop automaticly when the function ends? Something to do with scope. Could it have something to do with the fact the function returns only an integer? And that causes the table to be drop. As you can see I'm lost here! Johnf