Re: Dynamic function execution?

Поиск
Список
Период
Сортировка
От Nick Johnson
Тема Re: Dynamic function execution?
Дата
Msg-id 693AEAED-62B9-4644-BEEB-18AC608B5E31@notdot.net
обсуждение исходный текст
Ответ на Re: Dynamic function execution?  ("Merlin Moncure" <mmoncure@gmail.com>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: â in text field
Следующее
От: "Paulo Henrique Oliveira"
Дата:
Сообщение: Error in Postgresql after a Machine Crash