summaryrefslogtreecommitdiff
path: root/src/bin/psql/help.c
diff options
context:
space:
mode:
authorTom Lane2019-07-05 16:32:36 +0000
committerTom Lane2019-07-05 16:32:36 +0000
commit02e95a5049f7933cbde1dacf401604ea3fc02aa5 (patch)
treea9d0c9c0645dbc17c16c2cba4c47d58eacc99b7e /src/bin/psql/help.c
parente8fdcacc6cbeed7d1a2175c5eddf0b162e0cb7c4 (diff)
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/[email protected]
Diffstat (limited to 'src/bin/psql/help.c')
-rw-r--r--src/bin/psql/help.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 5fb1baadc57..d9b982d3a0b 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -169,7 +169,7 @@ slashUsage(unsigned short int pager)
* Use "psql --help=commands | wc" to count correctly. It's okay to count
* the USE_READLINE line even in builds without that.
*/
- output = PageOutput(127, pager ? &(pset.popt.topt) : NULL);
+ output = PageOutput(128, pager ? &(pset.popt.topt) : NULL);
fprintf(output, _("General\n"));
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
@@ -206,11 +206,12 @@ slashUsage(unsigned short int pager)
fprintf(output, _("Input/Output\n"));
fprintf(output, _(" \\copy ... perform SQL COPY with data stream to the client host\n"));
- fprintf(output, _(" \\echo [STRING] write string to standard output\n"));
+ fprintf(output, _(" \\echo [-n] [STRING] write string to standard output (-n for no newline)\n"));
fprintf(output, _(" \\i FILE execute commands from file\n"));
fprintf(output, _(" \\ir FILE as \\i, but relative to location of current script\n"));
fprintf(output, _(" \\o [FILE] send all query results to file or |pipe\n"));
- fprintf(output, _(" \\qecho [STRING] write string to query output stream (see \\o)\n"));
+ fprintf(output, _(" \\qecho [-n] [STRING] write string to \\o output stream (-n for no newline)\n"));
+ fprintf(output, _(" \\warn [-n] [STRING] write string to standard error (-n for no newline)\n"));
fprintf(output, "\n");
fprintf(output, _("Conditional\n"));