Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 51D469FB655 for ; Thu, 25 Jan 2007 12:09:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 31117-03 for ; Thu, 25 Jan 2007 12:09:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id B303E9FB651 for ; Thu, 25 Jan 2007 12:09:36 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l0PG9XQX020031; Thu, 25 Jan 2007 11:09:33 -0500 (EST) To: mario.splivalo@mobart.hr cc: pgsql-sql@postgresql.org Subject: Re: Using Temporary Tables in postgres functions In-reply-to: <1169735954.31872.38.camel@localhost.localdomain> References: <1169735954.31872.38.camel@localhost.localdomain> Comments: In-reply-to Mario Splivalo message dated "Thu, 25 Jan 2007 15:39:14 +0100" Date: Thu, 25 Jan 2007 11:09:33 -0500 Message-ID: <20030.1169741373@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/121 X-Sequence-Number: 27273 Mario Splivalo writes: > Am I doing something wrong here, or there is no way of using temporary > tables within 'sql' written functions? I believe the problem is that for a SQL function we parse the whole function body before executing any of it. So you'd need to split this into two separate functions. regards, tom lane