Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1louip-0005G4-6a for pgsql-general@arkaria.postgresql.org; Thu, 03 Jun 2021 21:17:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1louio-000401-68 for pgsql-general@arkaria.postgresql.org; Thu, 03 Jun 2021 21:17:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1louin-0003y0-AV for pgsql-general@lists.postgresql.org; Thu, 03 Jun 2021 21:17:45 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1louik-0007bo-Ii for pgsql-general@lists.postgresql.org; Thu, 03 Jun 2021 21:17:44 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 9115C5C0221; Thu, 3 Jun 2021 17:17:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 03 Jun 2021 17:17:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=p VCYGkE2FPq2/iaUq361LYRud+GBzqTZpNQDrs3K06M=; b=vN7V+i1GCQMcpAHYh 6gxvT6VSDwt4NPiHXjJouFg7KFdlSZKfVqKjYigIlgk1MJiogG/9KOTu0YESjUe0 wN1ppBmYBsjQD63w4WZlocbNs7IrZ6rBtdCJElt5s/MKgoX3vCDbDkc4Ai/6YVOJ vd70oPxv5rNMp860cZDpNu3WQWwZy3sPlHq0yH/Ae2bCmIxMhf5blAK7KNqoN1Mx bYAV8TN8IgFnKLvdN1ajSUUnCb2lkA5d2ZDKODC0+tYL9uFUEJa01GsyCyMEx8ye yV+s0/D4ObIGM9wfH6nrCLHi4BqBSIy/rz9hyjUvsin0v0Z5bquMZrhhf040Vhi8 gNn5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=pVCYGkE2FPq2/iaUq361LYRud+GBzqTZpNQDrs3K0 6M=; b=iyRRe89DG1WyahQn2UbvXlF5G08dBcFmYbSr2ypXuSgEFe32bGmP1lf05 Zh8gwE0x/+g3nh3f/np2ZGVlyvLjYThMzoDxgo5t/KIoHXoZN1Ay08/SRNxhCqvo C+x8nSJ15BVeJkayFSaDGpp38S2tCYwfeSUCyGXGt/q+bri2YEMUQ2F+v5J3z/zY IPVoaoVO2UM+48wz4Z/UWWYopXZ9mdgMrtNalQGSr8YlVL029Od1vbJxGwTPovwB vzL9z8tG43qAG6XOBCnUdC/uTNlcI17hKtQV2DtoN6voFUlaRPT5Suqr3PAWRn3U 5hGLbJPji6EZLyi9eb5LVxPL/3xuw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdelledgudehlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnhepkeehtdfgteekgfefleefveejhfettdfhudeutddt ffduteffvdejjedvffeitddunecuffhomhgrihhnpehmohhkrggusgdrtghomhenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Jun 2021 17:17:39 -0400 (EDT) Subject: Re: syntax question To: Marc Millas Cc: Bruce Momjian , "pgsql-general@lists.postgresql.org" References: <20210603190108.GC22019@momjian.us> From: Adrian Klaver Message-ID: <536d6eda-9ea9-cd49-84a6-25808073e2ce@aklaver.com> Date: Thu, 3 Jun 2021 14:17:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/3/21 1:01 PM, Marc Millas wrote: > thanks Adrian, exactly what I was missing :-) > > about knowing if I should... > We have to create a set of triggers (insert, update, delete) within a > huge set of tables. and that list of tables, and structure of them  can > be customized, maintained, ... > so we were looking for a standard script to automatize the building of > the whole thing, taking list of columns  and constraints (for PK) > directly from pg_catalog. > Now it works :-) > > but.. why do you ask that question ? is there any king of hidden wolf we > didnt see ? See David Johnston's answer. Nested quoting will drive you to drink(or drink more):) > > > Marc MILLAS > Senior Architect > +33607850334 > www.mokadb.com > > > > On Thu, Jun 3, 2021 at 9:11 PM Adrian Klaver > wrote: > > On 6/3/21 12:01 PM, Bruce Momjian wrote: > > On Thu, Jun  3, 2021 at 08:58:03PM +0200, Marc Millas wrote: > >> Hi, > >> > >> within a function, I want to create another function. > >> no pb. > >> but if I write: > >> declare bidule text; > >> begin > >> bidule:='myfunc'; > >> create function bidule() ... > >> > >> > >> it does create a function named bidule and not myfunc. > >> so I am obviously missing something too obvious. > > > > You can't create functions inside of functions;  same for procedures. > > > > Sure you can: > > CREATE OR REPLACE FUNCTION public.test_fnc() >   RETURNS void >   LANGUAGE plpgsql > AS $function$ > DECLARE >       bidule text; > BEGIN > bidule:='myfunc'; > EXECUTE  'create function ' ||  bidule || '() RETURNS void language > plpgsql AS $fnc$ BEGIN END; $fnc$ '; > END; > > > $function$ > > select test_fnc(); >   test_fnc > ---------- > >   \df myfunc >                          List of functions >   Schema |  Name  | Result data type | Argument data types | Type > --------+--------+------------------+---------------------+------ >   public | myfunc | void             |                     | func > > > Whether you should is another question. > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com