diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-07-05 12:32:36 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-07-05 12:32:36 -0400 |
commit | 02e95a5049f7933cbde1dacf401604ea3fc02aa5 (patch) | |
tree | a9d0c9c0645dbc17c16c2cba4c47d58eacc99b7e /doc/src | |
parent | e8fdcacc6cbeed7d1a2175c5eddf0b162e0cb7c4 (diff) | |
download | postgresql-02e95a5049f7933cbde1dacf401604ea3fc02aa5.tar.gz postgresql-02e95a5049f7933cbde1dacf401604ea3fc02aa5.zip |
Add \warn command to psql.
This is like \echo except that the text is sent to stderr not stdout.
In passing, fix a pre-existing bug in \echo and \qecho: per documentation
the -n switch should only be recognized when it is the first argument,
but actually any argument matching "-n" was treated as a switch.
(Should we back-patch that?)
David Fetter (bug fix by me), reviewed by Fabien Coelho
Discussion: https://postgr.es/m/20190421183115.GA4311@fetter.org
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/psql-ref.sgml | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 3cd0a99d079..7789fc61776 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1863,22 +1863,22 @@ testdb=> <term><literal>\echo <replaceable class="parameter">text</replaceable> [ ... ]</literal></term> <listitem> <para> - Prints the arguments to the standard output, separated by one - space and followed by a newline. This can be useful to + Prints the evaluated arguments to standard output, separated by + spaces and followed by a newline. This can be useful to intersperse information in the output of scripts. For example: <programlisting> => <userinput>\echo `date`</userinput> Tue Oct 26 21:40:57 CEST 1999 </programlisting> If the first argument is an unquoted <literal>-n</literal> the trailing - newline is not written. + newline is not written (nor is the first argument). </para> <tip> <para> If you use the <command>\o</command> command to redirect your query output you might wish to use <command>\qecho</command> - instead of this command. + instead of this command. See also <command>\warn</command>. </para> </tip> </listitem> @@ -3227,6 +3227,18 @@ testdb=> <userinput>\setenv LESS -imx4F</userinput> <varlistentry> + <term><literal>\warn <replaceable class="parameter">text</replaceable> [ ... ]</literal></term> + <listitem> + <para> + This command is identical to <command>\echo</command> except + that the output will be written to <application>psql</application>'s + standard error channel, rather than standard output. + </para> + </listitem> + </varlistentry> + + + <varlistentry> <term><literal>\watch [ <replaceable class="parameter">seconds</replaceable> ]</literal></term> <listitem> <para> |