From: | "Andrew Dunstan" <andrew(at)dunslane(dot)net> |
---|---|
To: | <neilc(at)samurai(dot)com> |
Cc: | <alvherre(at)dcc(dot)uchile(dot)cl>, <immaad(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Executing Anonymous Blocks |
Date: | 2005-03-29 11:55:55 |
Message-ID: | 1089.24.211.165.134.1112097355.squirrel@www.dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
Neil Conway said:
> Alvaro Herrera wrote:
>> On Mon, Mar 28, 2005 at 12:27:18PM +0500, imad wrote:
>>>I want to know is there any way to execute an anonymous PL/pgSQL block
>>>in PostgreSQL.
>>
>> No, there isn't.
>
> It might be possible to implement at least some of this functionality
> entirely in the client. So:
>
> BLOCK;
> /* your pl/pgsql code here */
> END BLOCK;
>
> Could be transformed by the client app to:
>
> CREATE FUNCTION anon_xxx() AS '/* your pl/pgsql code here'
> RETURNS void LANGUAGE 'plpgsql';
> SELECT anon_xxx();
> DROP FUNCTION anon_xxx();
>
> This would be pretty limited -- you couldn't get a return value from
> the anonymous block, for example -- but I can see it being useful in
> some situations.
>
I don't see that performing the same transformation at the SQL level would
be any harder. Then if we ever got SQL host variables we might have a good
way of using them ;-). Of course, another question is whether we should make
plpgsql special, or allow anonymous blocks in any supported language.
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Reini Urban | 2005-03-29 12:29:43 | Re: minor windows & cygwin regression failures on stable |
Previous Message | 윤동수 | 2005-03-29 11:46:44 | when using a bound cursor, error found.. |
From | Date | Subject | |
---|---|---|---|
Next Message | T E Schmitz | 2005-03-29 13:21:15 | Re: cost of CREATE VIEW ... AS SELECT DISTINCT |
Previous Message | 윤동수 | 2005-03-29 11:49:49 | when using a bound cursor, error found... |