initialization phase for user-defined functions

From: "g(dot)p(dot)ciceri" <gp(dot)ciceri(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: initialization phase for user-defined functions
Date: 2000-09-27 19:40:22
Message-ID: 39D24D26.1D33136D@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hello all,
I'd like to know if it's possible with the new fmgr
(or if it was already possible with the existing 7.0x fmgr),
handle a sort of "initialization phase" for an user-defined
function.

I mean,
suppose I have to do a simple

select myfield, myfunction(myfield) from anhugetable

where myfunction is an user-defined C function that has to
perform a "slow" initialization task (say, connect to an external
server like LDAP) followed by the needed "fast" operation (say, do an
ldapsearch).

For all the examples I've seen, it seems to me that with the
current fmgr, myfunction has to perform the initialization
phase FOR EACH RECORD.

What I really would like to do is:

1. initialize the function on demand only one time
2. perform the needed "fast" operation for each record
3. unload the routine (and so clear the environment)

Any idea if it is possible (or will be possible), and how,
handle situations like this ???

Any suggestion will be appreciated, sorry for my poor
written English (the spoken version is even worse :-)).

Regards,
/gp

--
Discussion: How do you feel about Open Source firms making
millions through public offerings?

"I wish these companies were making the same millions without
distributing any non-free, user-subjugating software." --
Richard Stallman

"We're not here to let the monkey dances." --
g.p.

Gian Paolo Ciceri Via B.Diotti 45 - 20153 Milano MI ITALY
CTO @ TiALabs mobile : ++39 347 4106213
eMail : gp(dot)ciceri(at)acm(dot)org
webSite: http://www.tialabs.com

Browse pgsql-general by date

  From Date Subject
Next Message Craig Anderson 2000-09-27 19:52:51 Converting money types.
Previous Message Adam Lang 2000-09-27 19:20:33 Re: sql question