dynamic functions in plpgsql

Поиск
Список
Период
Сортировка
От Tyler Bye
Тема dynamic functions in plpgsql
Дата
Msg-id 6987538FE5E0D3119F1B0050DA7350D143816D@MERCURY
обсуждение исходный текст
Список pgsql-novice
I'm currently trying to write a function that will query a table containing
the names of additional functions and then execute one of those functions
after selecting it from the table.

For example.

Say I have a (partial) function pick_fruit(varchar(20),varchar(20))
    type_of_fruit ALIAS FOR $1;
    employee ALIAS FOR $2;
    temprec RECORD;
...

If I SELECT pick_fruit('apple');I would like this function to take the
argument apple and query my pick_fruit_functions table for the  function
named pick_fruit_apple, then execute that function.

let's say that my column name for that list of functions is funcname.

I've tried selecting the function into a RECORD as temprec.  Then I
attempted to reference the result like so,

SELECT temprec.funcname(employee);
...

Is this type of dynamic function binding possible using plpgsql?

I hope this message wasn't too cryptic.

Thanks,
Tyler Bye



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

Предыдущее
От: ERIC Lawson - x52010
Дата:
Сообщение: Re: PL/PGSQL syntax manual
Следующее
От: Tony Bazeley
Дата:
Сообщение: Quick test for JDBC drivers