From: Tom Lane <tgl@sss.pgh.pa.us>
To: Igor Neyman <ineyman@perceptron.com>
Cc: Abraham, Danny <danny_abraham@bmc.com>
Cc: pgsql-admin@postgresql.org, Devrim GÜNDÜZ <devrim@gunduz.org>
Subject: Re: anonymous block in Postgres - Hello World
Date: Thu, 24 May 2007 11:57:53 -0400
Message-ID: <5493.1180022273@sss.pgh.pa.us> (raw)
In-Reply-To: <F4C27E77F7A33E4CA98C19A9DC6722A201F01BF9@EXCHANGE.corp.perceptron.com>
References: <F8B9B12641FB6B4FAC761BDEF9D63B040CFB4680@tlv-ex-01.adprod.bmc.com>
<4805.1180019537@sss.pgh.pa.us>
<F4C27E77F7A33E4CA98C19A9DC6722A201F01BF9@EXCHANGE.corp.perceptron.com>
"Igor Neyman" <ineyman@perceptron.com> writes:
> CREATE OR REPLACE FUNCTION exec_plpgsql_block(exec_string text)
> RETURNS BOOLEAN
> AS $THIS$
> DECLARE lRet BOOLEAN;
> BEGIN
> EXECUTE 'CREATE OR REPLACE FUNCTION any_block()
> RETURNS VOID
> AS $$ ' || exec_string || ' $$LANGUAGE PLPGSQL;' ;
> PERFORM any_block();
> RETURN TRUE;
> END;
> $THIS$LANGUAGE PLPGSQL;
That hasn't failed for you yet? It will the first time you use $$
in the argument.
Use quote_literal() please ...
regards, tom lane
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-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, ineyman@perceptron.com, danny_abraham@bmc.com, devrim@gunduz.org
Subject: Re: anonymous block in Postgres - Hello World
In-Reply-To: <5493.1180022273@sss.pgh.pa.us>
* 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