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 1od1Ne-0006zb-MA for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Sep 2022 03:35:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1od1Md-0007Rh-Qd for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Sep 2022 03:34:31 +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 1od1Md-0007RU-GG for pgsql-hackers@lists.postgresql.org; Tue, 27 Sep 2022 03:34:31 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1od1Mb-00077u-99 for pgsql-hackers@lists.postgresql.org; Tue, 27 Sep 2022 03:34:30 +0000 Received: by mail-pf1-x42a.google.com with SMTP id l65so8536354pfl.8 for ; Mon, 26 Sep 2022 20:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date; bh=3UJamUZPvs83z8d2azFAtR4ZQPt3KOVB1F7SMpErZns=; b=EbTRqGp2teLcK+92R2izImq07gngLHOJ0f3AWSgoW/2Nh7BSAwIDMxrroxpnqsrBqx VNAJtGLiWUMyd7C9jIPzwchlH7qN3YPEh92Un8CbcADECDommSN4B1jJSptLhlN3yzjF ejrGoS33Untm3CwZVEb+n88+5qksWsDPW8RdL9l+CXNLvuqOcEXBkdqnO8lEdjr+jT2J HlsR9rE180XvHZDRvcLPAf3mIRcbidlXZfoHZmq+HMUg/Ijyj3nuZ7ZoM++RjHMUc3P+ CveXSLzpSEOhVXPsCp1BIVZ/+zZy+zTO8LFy6KoelSYFLPEoKxs4Br/xaINj7PAXuYBI edYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date; bh=3UJamUZPvs83z8d2azFAtR4ZQPt3KOVB1F7SMpErZns=; b=8IVvjHky91xRYtS5VQd8iVGZIhpMMfqU03mjPmnm+i6mHuU9vt+ZmxH3ktS3GvdoiI Hwe7xgXQ8FFHyoRHsNhqgh7UoAhbFeYa1mFMS5QewI7zse54DdVbVouZd9VfJQv3U9Vq t1Is+04a8UIggOks0r0ld0Q81nMqUYvWS/+MBKHlClliVXZPxtrSUhtVj8EoOwB+fcK8 e6mf9XUBOYt8p9qAFARMwsc2JiCy4iGfeh6m6chpYSVWxm8bIXznETu089i7CXaPwIR5 9WB1eG7TK6wpZzx14zTUaTB0FIoACJ8fancMn5dyAOBA36YwvqBX2evNr8SZvx2jgvjJ 5LCg== X-Gm-Message-State: ACrzQf0jnr+DC21E5khe5MVPisbGKBMgHScY6q+n8qrzXJtVoo33CWrC D3uQRKnMOaENEkZqRdVfWKc= X-Google-Smtp-Source: AMsMyM64014lL9dlrjOtEJ/2b4NgP1ooAj+JQBZe1vL7tRzs4lefFluT7kulQNLRQGeNUWbX7N1hng== X-Received: by 2002:a05:6a00:16c4:b0:535:890:d52 with SMTP id l4-20020a056a0016c400b0053508900d52mr26873413pfc.9.1664249668076; Mon, 26 Sep 2022 20:34:28 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id s22-20020a170902b19600b0015e8d4eb1f7sm239436plr.65.2022.09.26.20.34.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 26 Sep 2022 20:34:27 -0700 (PDT) Date: Tue, 27 Sep 2022 12:34:25 +0900 (JST) Message-Id: <20220927.123425.211849117477195012.horikyota.ntt@gmail.com> To: masao.fujii@oss.nttdata.com Cc: bt22nakamorit@oss.nttdata.com, pgsql-hackers@lists.postgresql.org Subject: Re: Make ON_ERROR_STOP stop on shell script failure From: Kyotaro Horiguchi In-Reply-To: References: <4c61d434cb72b2237b3279797b2a387f@oss.nttdata.com> <8a022f2c8de93ea79116f0b7eb42248a@oss.nttdata.com> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Wed, 21 Sep 2022 11:45:07 +0900, Fujii Masao wrote in > > > On 2022/09/20 15:15, bt22nakamorit wrote: > >>>> I thought that this action is rather unexpected since, based on the > >>>> word """ON_ERROR_STOP""", ones may expect that failures of shell > >>>> scripts should halt the incoming instructions as well. > >>>> One clear solution is to let failures of shell script stop incoming > >>>> queries just like how errors of SQLs do currently. Thoughts? > > +1 > > > > I edited the documentation for ON_ERROR_STOP. > > Any other suggestions? > > Thanks for the patch! > Could you add it to the next CommitFest so that we don't forget it? > > > We can execute the shell commands via psql in various ways > other than \! meta-command. For example, > > * `command` > * \g | command > * \gx | command > * \o | command > * \w | command > * \copy ... program 'command' > > ON_ERROR_STOP should handle not only \! but also all the above in the > same way? +1 > One concern about this patch is that some applications already depend > on > the current behavior of ON_ERROR_STOP, i.e., psql doesn't stop even > when > the shell command returns non-zero exit code. If so, we might need to > extend ON_ERROR_STOP so that it accepts the following setting values. > > * off - don't stop even when either sql or shell fails (same as the > * current behavior) > * on or sql - stop only whensql fails (same as the current behavior) > * shell - stop only when shell fails > * all - stop when either sql or shell fails > > Thought? +1 regards. -- Kyotaro Horiguchi NTT Open Source Software Center