PERFORM function in Plpgsql

Started by Yannick LOUVETalmost 22 years ago2 messagesgeneral
Jump to latest
#1Yannick LOUVET
y.louvet@atolcd.com

hello,

i want to call a function (function1() for example )in an other function.
simple,i guess :

....
PERFORM function1() ;
.....

it's ok, but the name of my function is a variable like :

.....
var_function := function1();
.....
PERFORM var_function;

and it doesn't work !!!
Is it possible to do that ?

thanks

version :
PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.1
(Mandrake Linux 9.2 3.3.1-1mdk)

#2Adam Ruth
aruth@intercation.com
In reply to: Yannick LOUVET (#1)
Re: PERFORM function in Plpgsql

On Apr 29, 2004, at 9:22 AM, Yannick LOUVET wrote:

hello,

i want to call a function (function1() for example )in an other
function.
simple,i guess :

....
PERFORM function1() ;

You will want to use EXECUTE instead (assuming var_function is a text
variable):

EXECUTE var_function;

You may need to add parenthesis and a select:

EXECUTE 'select ' || var_function || '()';

Show quoted text

.....

it's ok, but the name of my function is a variable like :

.....
var_function := function1();
.....
PERFORM var_function;

and it doesn't work !!!
Is it possible to do that ?

thanks

version :
PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.1
(Mandrake Linux 9.2 3.3.1-1mdk)