public inbox for [email protected]
help / color / mirror / Atom feedpsql's ON_ERROR_STOP is misdocumented
6+ messages / 3 participants
[nested] [flat]
* psql's ON_ERROR_STOP is misdocumented
@ 2011-05-05 15:20 Tom Lane <[email protected]>
2011-06-13 15:01 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2011-05-05 15:20 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: psql's ON_ERROR_STOP is misdocumented
2011-05-05 15:20 psql's ON_ERROR_STOP is misdocumented Tom Lane <[email protected]>
@ 2011-06-13 15:01 ` Robert Haas <[email protected]>
2011-06-14 15:07 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Robert Haas @ 2011-06-13 15:01 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: pgsql-docs
On Thu, May 5, 2011 at 11:20 AM, Tom Lane <[email protected]> wrote:
> 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?
Here's an attempt at some suitable word-smithing.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Attachments:
[application/octet-stream] on-error-stop.patch (1.9K, 2-on-error-stop.patch)
download | inline diff:
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index eaf901d..d77a1aa 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -2770,18 +2770,16 @@ bar
<term><varname>ON_ERROR_STOP</varname></term>
<listitem>
<para>
- By default, if non-interactive scripts encounter an error, such
- as a malformed <acronym>SQL</acronym> command or internal
- meta-command, processing continues. This has been the
- traditional behavior of <application>psql</application> 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
- <application>psql</application> session but rather using the
- <option>-f</option> option, <application>psql</application> will
- return error code 3, to distinguish this case from fatal error
- conditions (error code 1).
+ By default, command processing continues after an error. When this
+ variale is set, it will instead stop immediately. In interactive mode,
+ <application>psql</application> will return to the command prompt;
+ otherwise, <application>psql</application> will exit, returning
+ error code 3 to distinguish this case from fatal error
+ conditions, which are reported using error code 1. In either case,
+ any currently running scripts (the toplevel script, if any, and any
+ other scripts which it may have in invoked) will be terminated
+ immediately. If the toplevel command string contained multiple SQL
+ commands, processing will stop with the current command.
</para>
</listitem>
</varlistentry>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: psql's ON_ERROR_STOP is misdocumented
2011-05-05 15:20 psql's ON_ERROR_STOP is misdocumented Tom Lane <[email protected]>
2011-06-13 15:01 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
@ 2011-06-14 15:07 ` Robert Haas <[email protected]>
2011-06-14 15:12 ` Re: psql's ON_ERROR_STOP is misdocumented Josh Kupershmidt <[email protected]>
2011-06-14 15:14 ` Re: psql's ON_ERROR_STOP is misdocumented Tom Lane <[email protected]>
0 siblings, 2 replies; 6+ messages in thread
From: Robert Haas @ 2011-06-14 15:07 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: pgsql-docs
On Mon, Jun 13, 2011 at 11:01 AM, Robert Haas <[email protected]> wrote:
> On Thu, May 5, 2011 at 11:20 AM, Tom Lane <[email protected]> wrote:
>> 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?
>
> Here's an attempt at some suitable word-smithing.
Hearing no objections, committed.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: psql's ON_ERROR_STOP is misdocumented
2011-05-05 15:20 psql's ON_ERROR_STOP is misdocumented Tom Lane <[email protected]>
2011-06-13 15:01 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
2011-06-14 15:07 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
@ 2011-06-14 15:12 ` Josh Kupershmidt <[email protected]>
1 sibling, 0 replies; 6+ messages in thread
From: Josh Kupershmidt @ 2011-06-14 15:12 UTC (permalink / raw)
To: Robert Haas <[email protected]>; +Cc: Tom Lane <[email protected]>; pgsql-docs
On Tue, Jun 14, 2011 at 11:07 AM, Robert Haas <[email protected]> wrote:
> Hearing no objections, committed.
s/variale/variable
Josh
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: psql's ON_ERROR_STOP is misdocumented
2011-05-05 15:20 psql's ON_ERROR_STOP is misdocumented Tom Lane <[email protected]>
2011-06-13 15:01 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
2011-06-14 15:07 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
@ 2011-06-14 15:14 ` Tom Lane <[email protected]>
2011-06-17 04:55 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
1 sibling, 1 reply; 6+ messages in thread
From: Tom Lane @ 2011-06-14 15:14 UTC (permalink / raw)
To: Robert Haas <[email protected]>; +Cc: pgsql-docs
Robert Haas <[email protected]> writes:
> Hearing no objections, committed.
Looking at this a second time, it needs spell-checked. "variale"?
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: psql's ON_ERROR_STOP is misdocumented
2011-05-05 15:20 psql's ON_ERROR_STOP is misdocumented Tom Lane <[email protected]>
2011-06-13 15:01 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
2011-06-14 15:07 ` Re: psql's ON_ERROR_STOP is misdocumented Robert Haas <[email protected]>
2011-06-14 15:14 ` Re: psql's ON_ERROR_STOP is misdocumented Tom Lane <[email protected]>
@ 2011-06-17 04:55 ` Robert Haas <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Robert Haas @ 2011-06-17 04:55 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: pgsql-docs
On Tue, Jun 14, 2011 at 11:14 AM, Tom Lane <[email protected]> wrote:
> Robert Haas <[email protected]> writes:
>> Hearing no objections, committed.
>
> Looking at this a second time, it needs spell-checked. "variale"?
Picky, picky. You say potato, I say potatoe.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2011-06-17 04:55 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-05-05 15:20 psql's ON_ERROR_STOP is misdocumented Tom Lane <[email protected]>
2011-06-13 15:01 ` Robert Haas <[email protected]>
2011-06-14 15:07 ` Robert Haas <[email protected]>
2011-06-14 15:12 ` Josh Kupershmidt <[email protected]>
2011-06-14 15:14 ` Tom Lane <[email protected]>
2011-06-17 04:55 ` Robert Haas <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox