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 1hQQrc-0005eG-BC for pgsql-general@arkaria.postgresql.org; Tue, 14 May 2019 06:24:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hQQra-0001uR-Dj for pgsql-general@arkaria.postgresql.org; Tue, 14 May 2019 06:24:34 +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 1hQQra-0001uF-3n for pgsql-general@lists.postgresql.org; Tue, 14 May 2019 06:24:34 +0000 Received: from mail114-240.sinamail.sina.com.cn ([218.30.114.240]) by magus.postgresql.org with smtp (Exim 4.89) (envelope-from ) id 1hQQrS-00036z-Ll for pgsql-general@postgresql.org; Tue, 14 May 2019 06:24:32 +0000 Received: from unknown (HELO t460p)([120.132.1.226]) by sina.com with ESMTP id 5CDA5F1500005009; Tue, 14 May 2019 14:24:21 +0800 (CST) X-Sender: wztdyl@sina.com X-Auth-ID: wztdyl@sina.com X-SMAIL-MID: 87627325953220 Message-ID: Subject: psql dones't reflect exit status if input command via stdin From: magodo To: Postgres general Date: Tue, 14 May 2019 14:24:20 +0800 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, I found when running command like `# echo "xxx" | psql postgres postgres`, the return code is always 0 even though the command ("xxx") here is of invalid syntax. While the `psql -c` way handled exit code correctly. In the meanwhile, mysql client handled both cases correctly. --- Zhaoting.Weng