proper use of temp table in function

From: David Gagnon <gagnondav(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: proper use of temp table in function
Date: 2004-11-30 15:12:34
Message-ID: 20041130151234.48813.qmail@web20323.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

Sorry to ask since I'm pretty sure this kind of question have been asked
again an again. But I searched and haven't found my answer.

So here is the question, please help :-)

In plpgsql function how do you deal with temporary table. I need do a bunch of
data manipulations in my function before returning a ref cursor.

The problem is that, as you may know, the temp table aren't drop at the end of
the function. And if I try to drop the tables when the cursor is open on it I
get errors too.

And I need to be able to call the function simultaneously without one
interfering with the other. So table created by one instance of the function
don't know about tables created by other functions ...

I have 4 big selects to construct the data I need... I can't just put all in a
big one. So I need a way to store and read data between selects.

Thanks for your help!!

/David

' LANGUAGE 'plpgsql';

CREATE FUNCTION uk_usp_Comptabilite_AgeDeCompteClient(DATE, VARCHAR, VARCHAR,
INTEGER, INTEGER) RETURNS refcursor AS '
DECLARE


__________________________________
Do you Yahoo!?
All your favorites on one personal page Try My Yahoo!
http://my.yahoo.com

Browse pgsql-general by date

  From Date Subject
Next Message Mark 2004-11-30 15:16:26 installing postgresql .rpms not in /usr/bin
Previous Message Joolz 2004-11-30 15:08:55 Re: change natural column order