Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 324509FB30D for ; Wed, 11 Oct 2006 08:02:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 90587-04 for ; Wed, 11 Oct 2006 08:02:53 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from eastrmmtao04.cox.net (eastrmmtao04.cox.net [68.230.240.35]) by postgresql.org (Postfix) with ESMTP id CC1B49F9FE1 for ; Wed, 11 Oct 2006 08:02:51 -0300 (ADT) Received: from eastrmimpo01.cox.net ([68.1.16.119]) by eastrmmtao04.cox.net (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP id <20061011110249.CQGT25210.eastrmmtao04.cox.net@eastrmimpo01.cox.net>; Wed, 11 Oct 2006 07:02:49 -0400 Received: from [192.168.1.100] ([68.99.49.95]) by eastrmimpo01.cox.net with bizsmtp id Yz2Y1V05W23Dr9w0000000 Wed, 11 Oct 2006 07:02:33 -0400 Subject: Re: Temp tables and functions From: "Mark R. Dingee" Reply-To: mark.dingee@cox.net To: "Jim C. Nasby" Cc: pgsql-sql@postgresql.org In-Reply-To: <20061011021151.GI72517@nasby.net> References: <398587.1160508096610.JavaMail.root@eastrmwml06.mgt.cox.net> <20061011021151.GI72517@nasby.net> Content-Type: text/plain Date: Wed, 11 Oct 2006 07:02:47 -0400 Message-Id: <1160564567.12626.54.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-4.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.155 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS X-Spam-Level: *** X-Archive-Number: 200610/108 X-Sequence-Number: 26497 Thanks, Jim. I'll give it a try. On Tue, 2006-10-10 at 21:11 -0500, Jim C. Nasby wrote: > 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).