On Mon, 29 Oct 2018, Rich Shepard wrote:
But, when I try to redirect output to a disk file like this,
\o data-summary-by-form.txt
the result is an error:
The \o came from a stackexchange thread I found with a web search. Within
psql the \? help command indicates there is no \o option, but \g should do
the same thing. It doesn't. I'm still confused on how to redirect output to
a file.
A clue stick is needed.
You seem to need to distinguish between the command line options to psql and the meta commands that can be used within a script that is being executed by psql.
You should probably show all shell and commands and the psql script in full instead of bits and pieces.
This stuff does work and nothing you’ve shown as having executed is wrong so that error is coming from something you haven’t shown.
Read the psql documentation.
You can either use \out or \copy within psql script or redirect the shell output using shell features.
David J.