Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id B861A9FB3A7 for ; Tue, 10 Oct 2006 23:11:56 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 00716-04 for ; Wed, 11 Oct 2006 02:11:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 890C19FB372 for ; Tue, 10 Oct 2006 23:11:53 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 3A6CF56431; Tue, 10 Oct 2006 21:11:52 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Tue, 10 Oct 2006 21:11:52 -0500 Date: Tue, 10 Oct 2006 21:11:51 -0500 From: "Jim C. Nasby" To: mark.dingee@cox.net Cc: pgsql-sql@postgresql.org Subject: Re: Temp tables and functions Message-ID: <20061011021151.GI72517@nasby.net> References: <398587.1160508096610.JavaMail.root@eastrmwml06.mgt.cox.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <398587.1160508096610.JavaMail.root@eastrmwml06.mgt.cox.net> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:061011:mark.dingee@cox.net::r7Qi3yxxZHqCw5pX:000000000000000000 0000000000000000000000001Q9X X-Hashcash: 1:20:061011:pgsql-sql@postgresql.org::umJWqGkLkJJ6V2Mw:0000000000000 00000000000000000000000019az X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/107 X-Sequence-Number: 26496 On Tue, Oct 10, 2006 at 03:21:36PM -0400, mark.dingee@cox.net wrote: > Everyone, > > I've written a function (language = sql) which uses a temporary table to simplify the process; however, when I go to load the function I get: > > /var/lib/pgsql$cat thm.sql | psql test > ERROR: relation "lost_bus" does not exist > > where "lost_bus" is the name of my temp table. The function is just for a report that is run monthly, so I can create a permanent table if necessary, but I'd rather not. Create the temp table in your script that creates the function. You don't need to populate it or anything, you just need it to exist (prefferably with the correct definition). -- Jim Nasby jim@nasby.net EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)