From 02e95a5049f7933cbde1dacf401604ea3fc02aa5 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 5 Jul 2019 12:32:36 -0400 Subject: 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 --- doc/src/sgml/ref/psql-ref.sgml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'doc/src') 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=> \echo text [ ... ] - 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: => \echo `date` Tue Oct 26 21:40:57 CEST 1999 If the first argument is an unquoted -n the trailing - newline is not written. + newline is not written (nor is the first argument). If you use the \o command to redirect your query output you might wish to use \qecho - instead of this command. + instead of this command. See also \warn. @@ -3226,6 +3226,18 @@ testdb=> \setenv LESS -imx4F + + \warn text [ ... ] + + + This command is identical to \echo except + that the output will be written to psql's + standard error channel, rather than standard output. + + + + + \watch [ seconds ] -- cgit v1.2.3