Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id F153C9FB1F1 for ; Fri, 26 Jan 2007 10:57:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 50281-10 for ; Fri, 26 Jan 2007 10:57:30 -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 B6AF99FB1F8 for ; Fri, 26 Jan 2007 10:57:35 -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 l0QEvWiv023177; Fri, 26 Jan 2007 09:57:32 -0500 (EST) To: mario.splivalo@mobart.hr cc: pgsql-sql@postgresql.org Subject: Re: Using Temporary Tables in postgres functions In-reply-to: <1169808705.3045.21.camel@localhost.localdomain> References: <1169735954.31872.38.camel@localhost.localdomain> <20030.1169741373@sss.pgh.pa.us> <1169808705.3045.21.camel@localhost.localdomain> Comments: In-reply-to Mario Splivalo message dated "Fri, 26 Jan 2007 11:51:45 +0100" Date: Fri, 26 Jan 2007 09:57:32 -0500 Message-ID: <23176.1169823452@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/141 X-Sequence-Number: 27293 Mario Splivalo writes: > On Thu, 2007-01-25 at 11:09 -0500, Tom Lane wrote: >> 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. > Having two function complicates, a bit, interface between applicaation > and the database. But, then again, If I split it in two functions, then > one with the UPDATE still can't find temp table referenced in other > function, right? It can as long as the table already exists when the function is entered. regards, tom lane