Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D4268B5DBD5 for ; Tue, 14 Jun 2011 12:08:08 -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 40494-01 for ; Tue, 14 Jun 2011 15:08:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pz0-f46.google.com (mail-pz0-f46.google.com [209.85.210.46]) by mail.postgresql.org (Postfix) with ESMTP id 01F9DB5DBD1 for ; Tue, 14 Jun 2011 12:08:01 -0300 (ADT) Received: by pzk9 with SMTP id 9so2675598pzk.19 for ; Tue, 14 Jun 2011 08:08:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=N+peScPaTZG228KRwudf82fT+puMv56wmdAos8V4q7Q=; b=F2/LlK3H8SFjsw29uCkdc/GoU0uEn96kp0sfUE9N0Y8vpwqtkeNEXplD0TnRl8is7U a6GJtVNB/1u8VwLHWjFJ0xcyWDzwJZF0b9tCu7N+kN+lMhrbq9Z8g1kUer6wKC9NFQCD K/SjvzJyx9g3/MO0B/rqdRAZ1vXQmYOU5aiCI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ii8bRG/sPzmtkPitF59Y7orexWUe4iizzs0rFKW0wmc5GS/mfH4+/3FQ4Rcg61926i U5TSImTxfSl+bJU/RAY+9geHctsP/VULJLvSWR2FIH/ffOWlBKd/tPVAg+/xxk/S0Oqj szX8kIhsEVchbiajLPfuNLgColhEPHoMZWYfY= MIME-Version: 1.0 Received: by 10.68.31.234 with SMTP id d10mr2924056pbi.490.1308064079195; Tue, 14 Jun 2011 08:07:59 -0700 (PDT) Received: by 10.68.56.70 with HTTP; Tue, 14 Jun 2011 08:07:58 -0700 (PDT) In-Reply-To: References: <4087.1304608809@sss.pgh.pa.us> Date: Tue, 14 Jun 2011 11:07:58 -0400 Message-ID: Subject: Re: psql's ON_ERROR_STOP is misdocumented From: Robert Haas To: Tom Lane Cc: pgsql-docs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201106/70 X-Sequence-Number: 6844 On Mon, Jun 13, 2011 at 11:01 AM, Robert Haas wrote= : > On Thu, May 5, 2011 at 11:20 AM, Tom Lane wrote: >> The documentation for ON_ERROR_STOP states, or at least implies by >> omission, that it only affects the behavior in non-interactive scripts: >> >> =A0 =A0 =A0 =A0By default, if non-interactive scripts encounter an error= , such >> =A0 =A0 =A0 =A0as a malformed SQL command or internal meta-command, proc= essing >> =A0 =A0 =A0 =A0continues. This has been the traditional behavior of psql= but it >> =A0 =A0 =A0 =A0is sometimes not desirable. If this variable is set, scri= pt >> =A0 =A0 =A0 =A0processing will immediately terminate. If the script was = called >> =A0 =A0 =A0 =A0from another script it will terminate in the same fashion= . If >> =A0 =A0 =A0 =A0the outermost script was not called from an interactive p= sql >> =A0 =A0 =A0 =A0session but rather using the -f option, psql will return = error >> =A0 =A0 =A0 =A0code 3, to distinguish this case from fatal error conditi= ons >> =A0 =A0 =A0 =A0(error code 1). >> >> However, it is easily proven that it *does* affect interactive commands; >> just try two commands on one line: >> >> regression=3D# select 1/0; select 2; >> ERROR: =A0division by zero >> =A0?column? >> ---------- >> =A0 =A0 =A0 =A02 >> (1 row) >> >> regression=3D# \set ON_ERROR_STOP 1 >> regression=3D# select 1/0; select 2; >> ERROR: =A0division by zero >> regression=3D# >> >> Can we get the docs changed to reflect reality? > > Here's an attempt at some suitable word-smithing. Hearing no objections, committed. --=20 Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company