Creating Tables in Functions

From: Scott Wood <skwny(at)email(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Creating Tables in Functions
Date: 2000-05-19 14:28:02
Message-ID: 383872133.958746482309.JavaMail.root@web14.mail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)email(dot)com

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kyle Bateman 2000-05-19 14:57:29 bogus number
Previous Message Hannu Krosing 2000-05-19 14:05:16 Re: Re: [SQL] Foreign keys breaks tables permissions