Search Postgresql Archives

Re: Dynamic function execution?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14/03/2006, at 6:52 PM, Merlin Moncure wrote:

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

I just finished an implementation based on the suggestions of Michael Fuhr. My function retrieves system cache records for itself and the function it's being asked to call, then ensures the return types and all the argument types match. If that test is passed, it modifies its own fcinfo struct into the one required to call the function the user really wants, then calls FunctionCallInvoke to call it.

With this method, on the PGSQL end, you can CREATE FUNCTION with any arbitrary parameters and return type as long as the first parameter is oid, regproc, or regprocedure, and then call any function with a matching signature using the defined function.

Still not done (and won't be done, unless I develop a need or someone else wants it ) is determining when function calls are compatible even though they're not identical (eg, through use of polymorphic functions and ANYELEMENT/ANYARRAY).

-Nick Johnson

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux