Creating Tables in Functions - Mailing list pgsql-sql

From Scott Wood
Subject Creating Tables in Functions
Date
Msg-id 383872133.958746482309.JavaMail.root@web14.mail.com
Whole thread Raw
Responses Re: Creating Tables in Functions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
All,

I am trying to create a function that will create a temporary table and fill
that table with data.  Here is my function definition below (much simplified
for this discussion):

create function my_function() returns int4 as'

create temp table my_table(a integer);
insert into my_table values (1);
' language 'sql';

When I try to create this function, I always get the error:

ERROR: Relation 'my_table' does not exist

Of course if doesn't exist, I haven't created it yet!  What am I doing
wrong?  I am using 7.0.  Thanks in advance for any help.

Scott
skwny@email.com

-----------------------------------------------
FREE! The World's Best Email Address @email.com
Reserve your name now at http://www.email.com




pgsql-sql by date:

Previous
From: Kate Collins
Date:
Subject: Re: SQL command speed
Next
From: Kyle Bateman
Date:
Subject: bogus number