summaryrefslogtreecommitdiff
path: root/src/bin/psql/help.c
diff options
context:
space:
mode:
authorTom Lane2020-04-07 21:46:29 +0000
committerTom Lane2020-04-07 21:46:29 +0000
commitb63c293bcbd7439f883cd4cf748f6755df0fbb3c (patch)
tree0852b2e4c0850d0bdd51507f931475e834feadb5 /src/bin/psql/help.c
parent0f5ca02f53ac2b211d8518f0882c49284c0c9610 (diff)
Allow psql's \g and \gx commands to transiently change \pset options.
We invented \gx to allow the "\pset expanded" flag to be forced on for the duration of one command output, but that turns out to not be nearly enough to satisfy the demand for variant output formats. Hence, make it possible to change any pset option(s) for the duration of a single command output, by writing "option=value ..." inside parentheses, for example \g (format=csv csv_fieldsep='\t') somefile \gx can now be understood as a shorthand for including expanded=on inside the parentheses. Patch by me, expanding on a proposal by Pavel Stehule Discussion: https://postgr.es/m/CAFj8pRBx9OnBPRJVtfA5ycUpySge-XootAXAsv_4rrkHxJ8eRg@mail.gmail.com
Diffstat (limited to 'src/bin/psql/help.c')
-rw-r--r--src/bin/psql/help.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 9a18cb30594..e7509480429 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -68,7 +68,7 @@ usage(unsigned short int pager)
* Keep this line count in sync with the number of lines printed below!
* Use "psql --help=options | wc" to count correctly.
*/
- output = PageOutput(62, pager ? &(pset.popt.topt) : NULL);
+ output = PageOutput(63, pager ? &(pset.popt.topt) : NULL);
fprintf(output, _("psql is the PostgreSQL interactive terminal.\n\n"));
fprintf(output, _("Usage:\n"));
@@ -169,17 +169,18 @@ 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(128, pager ? &(pset.popt.topt) : NULL);
+ output = PageOutput(133, pager ? &(pset.popt.topt) : NULL);
fprintf(output, _("General\n"));
fprintf(output, _(" \\copyright show PostgreSQL usage and distribution terms\n"));
fprintf(output, _(" \\crosstabview [COLUMNS] execute query and display results in crosstab\n"));
fprintf(output, _(" \\errverbose show most recent error message at maximum verbosity\n"));
- fprintf(output, _(" \\g [FILE] or ; execute query (and send results to file or |pipe)\n"));
+ fprintf(output, _(" \\g [(OPTIONS)] [FILE] execute query (and send results to file or |pipe);\n"));
+ fprintf(output, _(" \\g with no arguments is equivalent to a semicolon\n"));
fprintf(output, _(" \\gdesc describe result of query, without executing it\n"));
fprintf(output, _(" \\gexec execute query, then execute each value in its result\n"));
fprintf(output, _(" \\gset [PREFIX] execute query and store results in psql variables\n"));
- fprintf(output, _(" \\gx [FILE] as \\g, but forces expanded output mode\n"));
+ fprintf(output, _(" \\gx [(OPTIONS)] [FILE] as \\g, but forces expanded output mode\n"));
fprintf(output, _(" \\q quit psql\n"));
fprintf(output, _(" \\watch [SEC] execute query every SEC seconds\n"));
fprintf(output, "\n");