Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 3DB599FB846 for ; Thu, 24 May 2007 12:58:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 14834-01 for ; Thu, 24 May 2007 12:58:42 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C50809FB828 for ; Thu, 24 May 2007 12:58:41 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l4OFvrE9005494; Thu, 24 May 2007 11:57:53 -0400 (EDT) To: "Igor Neyman" cc: "Abraham, Danny" , pgsql-admin@postgresql.org, =?iso-8859-1?Q?Devrim_G=DCND=DCZ?= Subject: Re: anonymous block in Postgres - Hello World In-reply-to: References: <4805.1180019537@sss.pgh.pa.us> Comments: In-reply-to "Igor Neyman" message dated "Thu, 24 May 2007 11:31:33 -0400" Date: Thu, 24 May 2007 11:57:53 -0400 Message-ID: <5493.1180022273@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/271 X-Sequence-Number: 25591 "Igor Neyman" 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