Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id B3CA8633956 for ; Mon, 1 Mar 2010 17:50:45 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 26982-04-3 for ; Mon, 1 Mar 2010 21:50:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f223.google.com (mail-fx0-f223.google.com [209.85.220.223]) by mail.postgresql.org (Postfix) with ESMTP id 34E3063294D for ; Mon, 1 Mar 2010 17:50:25 -0400 (AST) Received: by fxm23 with SMTP id 23so623666fxm.3 for ; Mon, 01 Mar 2010 13:50:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=mhS8LUKv2/kpUrSEN5b+66TP/5yEW01y3S7WvkCCbHk=; b=XbfHX33OyCak1zDnP7KZjPGDtBuwdtnoijvAiTVoZ33hFRjmFwG2HVi9uEDYxt2jEz VWxU36EP1OxL9d6W2pKUtQL9gPBR0Y7ppjJLcuLgqL3NXqb6m1GviN/XT/yJHT0oa/Yq v+tNM9poR4qZEy0RkU0VDpr8AqaUTMF+AuaKc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=isxDSm8nvZYdWvZpYF3HbyhzfM6zeBL1N2zw0U0G6daGpyODXjjDT63lSKB18RdPQi Aaivsj38KtO9+YxWZO1hy/l8fTyCM4WkGlexIxXJH3e5SLOoOEFLWpIuqysBb+LczKPO +bi0CEiKEcnm69rwIImbucOpfVHSd/NZb52rs= MIME-Version: 1.0 Received: by 10.239.131.4 with SMTP id 4mr519593hbl.173.1267480223126; Mon, 01 Mar 2010 13:50:23 -0800 (PST) Date: Mon, 1 Mar 2010 22:50:23 +0100 Message-ID: <5eca56861003011350pdc14fa5l2498c260bf68a90c@mail.gmail.com> Subject: Create functions using a function From: Gianvito Pio To: pgsql-sql@postgresql.org Content-Type: multipart/alternative; boundary=001485f44fc07594a40480c43c01 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.598 tagged_above=-10 required=5 tests=BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201003/7 X-Sequence-Number: 33714 --001485f44fc07594a40480c43c01 Content-Type: text/plain; charset=ISO-8859-1 Hi all, is there a way to define functions and/or triggers in a function? For example, can I create a function that takes an argument and defines a function that has the name passed as argument to the first function? Something like this ..... CREATE FUNCTION test (name varchar) RETURNS VOID AS $$ BEGIN CREATE FUNCTION name ( ) (here "name" should be expanded to the variable content) RETURNS .... ... END $$ Is there a way to do this? Thanks --001485f44fc07594a40480c43c01 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi all,
is there a way to define functions and/or triggers in a function= ?

For example, can I create a function that takes an argument and de= fines a function that has the name passed as argument to the first function= ?

Something like this .....

CREATE FUNCTION test (name varchar) RE= TURNS VOID AS $$
BEGIN
=A0=A0=A0=A0=A0=A0 CREATE FUNCTION name ( ) (h= ere "name" should be expanded to the variable content) RETURNS ..= ..
=A0=A0=A0=A0=A0=A0=A0 ...
=A0=A0=A0=A0=A0=A0
END
$$

Is there a way to do this? Thanks
--001485f44fc07594a40480c43c01--