How to allow pgcli to show query result in prompt window, instead of editor?

Viewed 128

pgcli is a command line tool, and I want it to show query result in prompt window. By default, it shows the result in an editor. How can I change the configuration?

1 Answers

If you mean the pager that psql invokes by default to display long result sets, it can be turned off.

Within the psql prompt :

\pset pager off

to configure the current psql session to always output results to stdout, as opposed to the default more-like pager allocated to long results.

  • cf. psql documentation, entries pager and pager_min_lines

  • cf. this post with alternative syntaxes, and how to save the configuration system-wide

For the purpose of exploiting or transforming the result, I usually find it more convenient to invoke psql with -c and then pipe the output to an editor or whatnot : e.g. psql -Atc 'select 1' | $EDITOR

Related