Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 47F1F8D31F0 for ; Sun, 4 Mar 2012 14:08:51 -0400 (AST) Received: from acidenitrix.villemain.org ([91.121.90.165]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S4FrR-0005oj-Tr for pgsql-hackers@postgresql.org; Sun, 04 Mar 2012 18:08:50 +0000 Received: from 89-158-241-83.rev.dartybox.com ([89.158.241.83] helo=DimIMac.local) by acidenitrix.villemain.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1S4Fr8-0003Oe-3Y; Sun, 04 Mar 2012 19:08:26 +0100 Received: by DimIMac.local (Postfix, from userid 501) id D05413C41605; Sun, 4 Mar 2012 19:08:18 +0100 (CET) From: Dimitri Fontaine To: Tom Lane Cc: Dimitri Fontaine , Thom Brown , PostgreSQL Hackers Subject: Re: Command Triggers, patch v11 Organization: 2ndQuadrant References: <18852.1330376038@sss.pgh.pa.us> User-Mail-Address: dimitri@2ndQuadrant.fr Date: Sun, 04 Mar 2012 19:08:18 +0100 In-Reply-To: <18852.1330376038@sss.pgh.pa.us> (Tom Lane's message of "Mon, 27 Feb 2012 15:53:58 -0500") Message-ID: User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/161 X-Sequence-Number: 204043 Tom Lane writes: > FWIW, I agree with Thom on this. If we do it as you suggest, I > confidently predict that it will be less than a year before we seriously > regret it. Given all the discussion around this, it's borderline insane > to believe that the set of parameters to be passed to command triggers > is nailed down and won't need to change in the future. > > As for special coding of support, it hardly seems onerous when every > language that has triggers at all has got some provision for the > existing trigger parameters. A bit of copying and pasting should get > the job done. So, for that to happen I need to add a new macro and use it in most call sites of CALLED_AS_TRIGGER(fcinfo). That includes the setup switch in src/pl/plpgsql/src/pl_comp.c doCompile() and plpgsql_call_handler() for starters. Let's call the macro CALLED_AS_COMMAND_TRIGGER(fcinfo), and I would extend CommandContextData to be a Node of type CommandTriggerData, that needs to be added to the NodeTag enum as T_CommandTriggerData. With that in place I can stuff the data into the function's call context (via InitFunctionCallInfoData) then edit the call handlers of included procedure languages until they are able to init their language variables with the info. Then, do we want the command trigger functions to return type trigger or another specific type? I guess we want to forbid registering any function as a command trigger? Regards, -- Dimitri Fontaine http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support