Thread: Temp tables and functions

Temp tables and functions

From
Date:
Everyone,

I've written a function (language = sql) which uses a temporary table to simplify the process; however, when I go to
loadthe 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
apermanent table if necessary, but I'd rather not. 
 

Thanks in advance
Mark


Re: Temp tables and functions

From
"Jim C. Nasby"
Date:
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
loadthe 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
createa 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)


Re: Temp tables and functions

From
"Mark R. Dingee"
Date:
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
toload 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
createa 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).