Re: Dynamic function execution?

From: Nick Johnson <arachnid(at)notdot(dot)net>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Dynamic function execution?
Date: 2006-03-15 01:30:34
Message-ID: F65AC517-AB1D-468C-BCAA-0BAC46A5B8FC@notdot.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 14/03/2006, at 10:26 AM, Michael Fuhr 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.

The example that's actually driving this is rather stupid (though
amusing). I'm building a Postgres based adventure game. Eg, SELECT n
(); SELECT look(); etc. I want to be able to execute on_enter,
on_exit etc events, the handles to the event functions being stored
in the table.

A more sensible example (though not one this will be immediately used
for) is something we're doing at my work: The database contains a
number of stored procedures implementing 'models' - they're functions
that essentially perform data-mining on the database. There's a table
that has metadata about each of these models, allowing the system to
determine which ones need executing, and when. Being able to directly
call them would be useful here, too.

-Nick Johnson

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2006-03-15 02:02:08 Re: Wisconsin Circuit Court Access (WCCA) on
Previous Message Chris 2006-03-15 00:47:05 Re: Turn OFF Stats of Postgresql