diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-09-05 11:58:20 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-09-05 11:58:33 -0400 |
commit | 0426f349effb6bde2061f3398a71db7180c97dd9 (patch) | |
tree | 741fcee27d57266182690fefd31721b8d6546b1e /src/bin/psql/help.c | |
parent | c80b5f66c6faff085e312492be0aa50754e99eb9 (diff) | |
download | postgresql-0426f349effb6bde2061f3398a71db7180c97dd9.tar.gz postgresql-0426f349effb6bde2061f3398a71db7180c97dd9.zip |
Rearrange the handling of error context reports.
Remove the code in plpgsql that suppressed the innermost line of CONTEXT
for messages emitted by RAISE commands. That was never more than a quick
backwards-compatibility hack, and it's pretty silly in cases where the
RAISE is nested in several levels of function. What's more, it violated
our design theory that verbosity of error reports should be controlled
on the client side not the server side.
To alleviate the resulting noise increase, introduce a feature in libpq
and psql whereby the CONTEXT field of messages can be suppressed, either
always or only for non-error messages. Printing CONTEXT for errors only
is now their default behavior.
The actual code changes here are pretty small, but the effects on the
regression test outputs are widespread. I had to edit some of the
alternative expected outputs by hand; hopefully the buildfarm will soon
find anything I fat-fingered.
In passing, fix up (again) the output line counts in psql's various
help displays. Add some commentary about how to verify them.
Pavel Stehule, reviewed by Petr JelĂnek, Jeevan Chalke, and others
Diffstat (limited to 'src/bin/psql/help.c')
-rw-r--r-- | src/bin/psql/help.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index d3e3114cb10..14d351f868d 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -65,7 +65,11 @@ usage(unsigned short int pager) } } - output = PageOutput(59, pager ? &(pset.popt.topt) : NULL); + /* + * Keep this line count in sync with the number of lines printed below! + * Use "psql --help=options | wc" to count correctly. + */ + output = PageOutput(60, pager ? &(pset.popt.topt) : NULL); fprintf(output, _("psql is the PostgreSQL interactive terminal.\n\n")); fprintf(output, _("Usage:\n")); @@ -158,9 +162,12 @@ slashUsage(unsigned short int pager) currdb = PQdb(pset.db); - output = PageOutput(103, pager ? &(pset.popt.topt) : NULL); - - /* if you add/remove a line here, change the row count above */ + /* + * Keep this line count in sync with the number of lines printed below! + * Use "psql --help=commands | wc" to count correctly. It's okay to count + * the USE_READLINE line even in builds without that. + */ + output = PageOutput(109, pager ? &(pset.popt.topt) : NULL); fprintf(output, _("General\n")); fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n")); @@ -307,7 +314,13 @@ helpVariables(unsigned short int pager) { FILE *output; - output = PageOutput(85, pager ? &(pset.popt.topt) : NULL); + /* + * Keep this line count in sync with the number of lines printed below! + * Use "psql --help=variables | wc" to count correctly; but notice that + * Windows builds currently print one more line than non-Windows builds. + * Using the larger number is fine. + */ + output = PageOutput(87, pager ? &(pset.popt.topt) : NULL); fprintf(output, _("List of specially treated variables.\n")); @@ -339,6 +352,7 @@ helpVariables(unsigned short int pager) fprintf(output, _(" PROMPT2 specify the prompt used when a statement continues from a previous line\n")); fprintf(output, _(" PROMPT3 specify the prompt used during COPY ... FROM STDIN\n")); fprintf(output, _(" QUIET run quietly (same as -q option)\n")); + fprintf(output, _(" SHOW_CONTEXT control display of message context fields [never, errors, always]\n")); fprintf(output, _(" SINGLELINE end of line terminates SQL command mode (same as -S option)\n")); fprintf(output, _(" SINGLESTEP single-step mode (same as -s option)\n")); fprintf(output, _(" USER the currently connected database user\n")); |