Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gOrn3-0000tA-2P for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Nov 2018 22:13:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gOrn0-0007Rr-Kv for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Nov 2018 22:13:06 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gOrn0-0007Rk-EB for pgsql-hackers@lists.postgresql.org; Mon, 19 Nov 2018 22:13:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gOrmw-0006fG-Hb for pgsql-hackers@lists.postgresql.org; Mon, 19 Nov 2018 22:13:06 +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 wAJMCrOI030692; Mon, 19 Nov 2018 17:12:54 -0500 From: Tom Lane To: Etsuro Fujita cc: Kyotaro HORIGUCHI , thomas.munro@enterprisedb.com, eric.cyr@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: BUG #15449: file_fdw using program cause exit code error when using LIMIT In-reply-to: <5BF23697.6020806@lab.ntt.co.jp> References: <5BE4318F.4040002@lab.ntt.co.jp> <20181109.143931.243136889.horiguchi.kyotaro@lab.ntt.co.jp> <5BE552ED.4040304@lab.ntt.co.jp> <20181112.185214.76711162.horiguchi.kyotaro@lab.ntt.co.jp> <5BE966F4.1040702@lab.ntt.co.jp> <5BEA9E82.1080709@lab.ntt.co.jp> <30744.1542388851@sss.pgh.pa.us> <31355.1542389631@sss.pgh.pa.us> <7865.1542407597@sss.pgh.pa.us> <9660.1542409841@sss.pgh.pa.us> <5BF23697.6020806@lab.ntt.co.jp> Comments: In-reply-to Etsuro Fujita message dated "Mon, 19 Nov 2018 13:05:43 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30690.1542665573.1@sss.pgh.pa.us> Date: Mon, 19 Nov 2018 17:12:53 -0500 Message-ID: <30691.1542665573@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Etsuro Fujita writes: > I agree that it's better to keep the BeginCopyFrom API as-is. Also, I > think your version would handle SIGPIPE in COPY FROM PROGRAM more > properly than what I proposed. So, +1 from me. Thanks for reviewing! I've pushed it now, though at the last minute I reconsidered resetting SIGUSR2 as my previous patch did. The trouble with resetting that is that it results in a small window where receipt of SIGUSR2 would result in backend termination, which we surely don't want. Now, it doesn't look to me like the postmaster will ever send SIGUSR2 to ordinary backends, but it wouldn't be terribly surprising if someone makes a change that relies on the expectation of SIGUSR2 being SIG_IGN'd by backends. I don't see any real upside to resetting SIGUSR2 for the called program that would justify taking any risk there. (Note that this concern doesn't apply to SIGPIPE since we only expect that to be raised synchronously, ie during a write.) As Kyotaro-san said upthread, it's odd that exec() provides no way to reset all the handlers to SIG_DFL on the child side. But since it doesn't, we're not really able to do much more than this. regards, tom lane