From: Neil Conway <neilc@samurai.com>
To: Alvaro Herrera <alvherre@dcc.uchile.cl>
Cc: imad <immaad@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Executing Anonymous Blocks
Date: Tue, 29 Mar 2005 17:59:44 +1000
Message-ID: <42490AF0.6040704@samurai.com> (raw)
In-Reply-To: <20050328144335.GB3574@dcc.uchile.cl>
References: <1f30b80c0503272327502a34a9@mail.gmail.com>
<20050328144335.GB3574@dcc.uchile.cl>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: neilc@samurai.com, alvherre@dcc.uchile.cl, immaad@gmail.com, pgsql-hackers@postgresql.org
Subject: Re: Executing Anonymous Blocks
In-Reply-To: <42490AF0.6040704@samurai.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox