psql's ON_ERROR_STOP is misdocumented

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-docs(at)postgreSQL(dot)org
Subject: psql's ON_ERROR_STOP is misdocumented
Date: 2011-05-05 15:20:09
Message-ID: 4087.1304608809@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2011-05-05 16:25:09 Re: characters or bytes?
Previous Message Tom Lane 2011-05-04 20:21:54 Re: Missing documentation for pg_role column