From: | Pierre Racine <Pierre(dot)Racine(at)sbf(dot)ulaval(dot)ca> |
---|---|
To: | Vibhor Kumar <vibhor(dot)kumar(at)enterprisedb(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Dynamic binding in plpgsql function |
Date: | 2011-03-02 15:06:53 |
Message-ID: | 87A96661E65C5541AB4D20721C2DD7F88DAED99078@EXCH-MBX-A.ulaval.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Is EXECUTE slower than a direct assignment call?
>-----Original Message-----
>From: Vibhor Kumar [mailto:vibhor(dot)kumar(at)enterprisedb(dot)com]
>Sent: 1 mars 2011 18:24
>To: Pierre Racine
>Cc: pgsql-general(at)postgresql(dot)org
>Subject: Re: [GENERAL] Dynamic binding in plpgsql function
>
>
>On Mar 2, 2011, at 4:31 AM, Pierre Racine wrote:
>
>> CREATE OR REPLACE FUNCTION ST_MyGeneralFunction(callback text)
>> RETURNS SETOF geomval AS $$
>> DECLARE
>> x integer;
>> y integer;
>> BEGIN
>> y := somecalculation;
>> x := 'callback'(y); --This is what I need
>> RETURN x;
>> END;
>> $$ LANGUAGE 'plpgsql';
>>
>> I don't want to do an EXECUTE statement since I have no table to put after the FROM clause. I want
>to assign the resulting value directly to a variable like in my example.
>
>
>You don't need any table to assign value of function to Variable, if function returning single value.
>You can use EXECUTE 'SELECT '||$1||'(y)' into x;
>
>Thanks & Regards,
>Vibhor Kumar
>EnterpriseDB Corporation
>The Enterprise PostgreSQL Company
>vibhor(dot)kumar(at)enterprisedb(dot)com
>Blog:http://vibhork.blogspot.com
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2011-03-02 15:12:12 | Re: Dynamic binding in plpgsql function |
Previous Message | Merlin Moncure | 2011-03-02 15:05:23 | Re: Dynamic binding in plpgsql function |