Re: PERFORM function in Plpgsql

From: Adam Ruth <aruth(at)intercation(dot)com>
To: Yannick LOUVET <y(dot)louvet(at)atolcd(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PERFORM function in Plpgsql
Date: 2004-05-05 16:12:00
Message-ID: F0BBAFD9-9EAE-11D8-B4BB-000A959D1424@intercation.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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 || '()';

> .....
>
> 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-05-05 16:17:35 Re: Date addition using Interval
Previous Message Lonni Friedman 2004-05-05 15:43:33 Re: vacuumdb is failing with NUMBER OF INDEX TUPLES NOT THE SAME AS HEAP