Skip site navigation (1) Skip section navigation (2)

Re: Executing Anonymous Blocks

From: Neil Conway <neilc(at)samurai(dot)com>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: imad <immaad(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Executing Anonymous Blocks
Date: 2005-03-29 07:59:44
Message-ID: 42490AF0.6040704@samurai.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-sql
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.

-Neil

In response to

Responses

pgsql-hackers by date

Next:From: 윤동수Date: 2005-03-29 11:46:44
Subject: when using a bound cursor, error found..
Previous:From: Christopher BrowneDate: 2005-03-29 05:12:55
Subject: Re: is postgresql 8 is realy mature

pgsql-sql by date

Next:From: T E SchmitzDate: 2005-03-29 10:07:20
Subject: Re: cost of CREATE VIEW ... AS SELECT DISTINCT
Previous:From: Scott MarloweDate: 2005-03-28 22:04:23
Subject: Re: cost of CREATE VIEW ... AS SELECT DISTINCT

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group