Re: Dynamic function execution?

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Dynamic function execution?
Дата
Msg-id 20060314080520.GA94277@winnie.fuhr.org
обсуждение исходный текст
Ответ на Dynamic function execution?  (Nick Johnson <arachnid@notdot.net>)
Ответы Re: Dynamic function execution?  (Nick Johnson <arachnid@notdot.net>)
Список pgsql-general
On Mon, Mar 13, 2006 at 10:45:47PM -0800, Nick Johnson wrote:
> Can anyone provide me with some direction on how to write a function
> I can load into postgres that will execute a function specified by
> OID (or regproc/regprocedure) at runtime, with type safety? I've been
> able to write such a function in C, but I was unable to figure out
> how to determine the parameters that the specified function expects,
> so I can prevent calling a function that doesn't match the expected
> signature (which segfaults postgres).

Does the calling function have to be written in C?  In PL/pgSQL you
could easily query pg_proc with the oid to get the called function's
name, argument types, etc., then build an appropriate string to
EXECUTE.  In C you could use SearchSysCache() and SysCacheGetAttr();
search through the source code for examples of calls to those
functions with a first argument of PROCOID.

Why do you need to do this?  What problem are you trying to solve?

--
Michael Fuhr

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

Предыдущее
От: r irussel
Дата:
Сообщение: Urgent !!! Please Help Me
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: [pgsql-advocacy] Wisconsin Circuit Court Access (WCCA) on