Re: Dynamic function execution?

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: "Nick Johnson" <arachnid(at)notdot(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Dynamic function execution?
Date: 2006-03-15 02:52:53
Message-ID: b42b73150603141852y1bca3babq9651280bb64a2a72@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/14/06, Michael Fuhr <mike(at)fuhr(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2006-03-15 03:00:18 Re: What's a good default encoding?
Previous Message Bruno Wolff III 2006-03-15 02:02:08 Re: Wisconsin Circuit Court Access (WCCA) on