Re: Dynamic function execution? - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Dynamic function execution?
Date
Msg-id b42b73150603141852y1bca3babq9651280bb64a2a72@mail.gmail.com
Whole thread Raw
In response to Re: Dynamic function execution?  (Michael Fuhr <mike@fuhr.org>)
Responses Re: Dynamic function execution?
List pgsql-general
On 3/14/06, Michael Fuhr <mike@fuhr.org> wrote:
> On Tue, Mar 14, 2006 at 07:21:51AM -0800, Nick Johnson wrote:
> > On 14/03/2006, at 12:05 AM, Michael Fuhr wrote:
> > >Why do you need to do this?  What problem are you trying to solve?
> >
> > I want to associate Postgres functions with rows of a table (eg, a
> > table column of datatype regproc or regprocedure) and be able to
> > execute the function associated with that  row in a query.
>
> Could you post an example?  Others might be interested in seeing
> an application of something like that.

If you go a ways back on the performance list you can see an example.
It's very simple: there are C functions which you can call which take
the oid and parameters.   Then you can do clever things like do
callbacks in plpgsql a function taking the function argument as a
string and looking up its oid.

to the original poster...it's probably possible.  one way would be to
sanity check pg_proc on the C side (at the least, check the # args).
there might be better/faster ways though

Merlin

pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Wisconsin Circuit Court Access (WCCA) on
Next
From: John DeSoi
Date:
Subject: Re: What's a good default encoding?