Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJMNt-0001BA-HA for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2017 16:35:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eJMNt-0002iN-1q for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Nov 2017 16:35:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eJMNs-0002iD-RC for pgsql-hackers@lists.postgresql.org; Mon, 27 Nov 2017 16:35:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eJMNk-0007vv-SK for pgsql-hackers@postgresql.org; Mon, 27 Nov 2017 16:35:52 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vARGZa0h020241; Mon, 27 Nov 2017 11:35:36 -0500 From: Tom Lane To: Dean Rasheed cc: Etsuro Fujita , Ashutosh Bapat , Ildus Kurbangaliev , Dilip Kumar , PostgreSQL Hackers , Robert Haas Subject: Re: [HACKERS] Bug in ExecModifyTable function and trigger issues for foreign tables In-reply-to: <18636.1511797772@sss.pgh.pa.us> References: <20170514150525.0346ba72@postgrespro.ru> <20170515165455.545dd3d6@wp.localdomain> <20170516150516.1b616230@wp.localdomain> <20170615180548.5e142ddc@wp.localdomain> <0bc9c28b-96ca-c875-871e-16af6f53ecd9@lab.ntt.co.jp> <428f1672-df54-de01-91da-b57365193bf4@lab.ntt.co.jp> <6c651916-8fde-f9c9-b199-080df1bf2867@lab.ntt.co.jp> <280720c5-7aad-1136-6be3-654208c8f714@lab.ntt.co.jp> <8065.1500475011@sss.pgh.pa.us> <9cd25d80-08fc-568c-3181-dbe98723d0db@lab.ntt.co.jp> <3e9ff40d-d00f-3363-dcee-97ce023c7884@lab.ntt.co.jp> <14028.1511736992@sss.pgh.pa.us> <18636.1511797772@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 27 Nov 2017 10:49:32 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20239.1511800536.1@sss.pgh.pa.us> Date: Mon, 27 Nov 2017 11:35:36 -0500 Message-ID: <20240.1511800536@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Dean Rasheed writes: >> A separate point -- it might be marginally more efficient to have the >> work of rewriteTargetListUD() done after expand_targetlist() to avoid >> the possible renumbering of the resjunk entries. > Hm. It wouldn't save a lot, but yeah, doing it in this order seems > a bit silly when you put it like that. On looking closer, the reason it's like that in Fujita-san's patch is to minimize the API churn seen by FDW AddForeignUpdateTargets functions, specifically whether they see a tlist that's before or after what expand_targetlist() does. I'm doubtful that the potential savings is worth taking risks there. In particular, it seems like a good thing that expand_targetlist() verifies the correct tlist ordering *after* the FDW function has acted. So now my inclination is to leave this alone. regards, tom lane