Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 4B3AD1337BB4 for ; Thu, 5 May 2011 12:20:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 78516-05 for ; Thu, 5 May 2011 15:20:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 126471337BF5 for ; Thu, 5 May 2011 12:20:09 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p45FK9dS004088 for ; Thu, 5 May 2011 11:20:09 -0400 (EDT) To: pgsql-docs@postgreSQL.org Subject: psql's ON_ERROR_STOP is misdocumented Date: Thu, 05 May 2011 11:20:09 -0400 Message-ID: <4087.1304608809@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/12 X-Sequence-Number: 6687 The documentation for ON_ERROR_STOP states, or at least implies by omission, that it only affects the behavior in non-interactive scripts: By default, if non-interactive scripts encounter an error, such as a malformed SQL command or internal meta-command, processing continues. This has been the traditional behavior of psql but it is sometimes not desirable. If this variable is set, script processing will immediately terminate. If the script was called from another script it will terminate in the same fashion. If the outermost script was not called from an interactive psql session but rather using the -f option, psql will return error code 3, to distinguish this case from fatal error conditions (error code 1). However, it is easily proven that it *does* affect interactive commands; just try two commands on one line: regression=# select 1/0; select 2; ERROR: division by zero ?column? ---------- 2 (1 row) regression=# \set ON_ERROR_STOP 1 regression=# select 1/0; select 2; ERROR: division by zero regression=# Can we get the docs changed to reflect reality? regards, tom lane