summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-04-06 17:33:38 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-04-06 17:33:38 -0400
commit31ae2aa9d2c200a0d7d3283d749669a408ec7b65 (patch)
treec8781c1909b5df38ed2c86bf334c1ae856f4a33c /doc/src
parent029dea882a7aa34f46732473eed7c917505e6481 (diff)
psql: set SHELL_ERROR and SHELL_EXIT_CODE in more places.
Make the \g, \o, \w, and \copy commands set these variables when closing a pipe. We missed doing this in commit b0d8f2d98, but it seems like a good idea. There are some remaining places in psql that intentionally don't update these variables after running a child program: * pager invocations * backtick evaluation within a prompt * \e (edit query buffer) Corey Huinker and Tom Lane Discussion: https://postgr.es/m/CADkLM=eSKwRGF-rnRqhtBORRtL49QsjcVUCa-kLxKTqxypsakw@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/psql-ref.sgml16
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 53875afbf02..f4f25d1b076 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -4277,8 +4277,12 @@ bar
<para>
<literal>true</literal> if the last shell command
failed, <literal>false</literal> if it succeeded.
- This applies to shell commands invoked via the <literal>\!</literal>
- meta-command or backquote (<literal>`</literal>) expansion.
+ This applies to shell commands invoked via the <literal>\!</literal>,
+ <literal>\g</literal>, <literal>\o</literal>, <literal>\w</literal>,
+ and <literal>\copy</literal> meta-commands, as well as backquote
+ (<literal>`</literal>) expansion. Note that
+ for <literal>\o</literal>, this variable is updated when the output
+ pipe is closed by the next <literal>\o</literal> command.
See also <varname>SHELL_EXIT_CODE</varname>.
</para>
</listitem>
@@ -4292,8 +4296,12 @@ bar
0&ndash;127 represent program exit codes, 128&ndash;255
indicate termination by a signal, and -1 indicates failure
to launch a program or to collect its exit status.
- This applies to shell commands invoked via the <literal>\!</literal>
- meta-command or backquote (<literal>`</literal>) expansion.
+ This applies to shell commands invoked via the <literal>\!</literal>,
+ <literal>\g</literal>, <literal>\o</literal>, <literal>\w</literal>,
+ and <literal>\copy</literal> meta-commands, as well as backquote
+ (<literal>`</literal>) expansion. Note that
+ for <literal>\o</literal>, this variable is updated when the output
+ pipe is closed by the next <literal>\o</literal> command.
See also <varname>SHELL_ERROR</varname>.
</para>
</listitem>