]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Allow psql's \g and \gx commands to transiently change \pset options.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 7 Apr 2020 21:46:29 +0000 (17:46 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 7 Apr 2020 21:46:29 +0000 (17:46 -0400)
commitb63c293bcbd7439f883cd4cf748f6755df0fbb3c
tree0852b2e4c0850d0bdd51507f931475e834feadb5
parent0f5ca02f53ac2b211d8518f0882c49284c0c9610
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
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/command.c
src/bin/psql/command.h
src/bin/psql/common.c
src/bin/psql/help.c
src/bin/psql/settings.h
src/test/regress/expected/psql.out
src/test/regress/sql/psql.sql