Almost every psql query comes out an illegible mess if not preceded by display configuration commands such as \\x auto. Typing this manually for each psql instance
There is an option of -x but it does not do the job for me as I am using COPY to send output to a file. Without copy "-x" works well!
So here is what I have done to read:
# psql -U postgres -o /tmp/output_file_name.txt <
One can morph the above to whatever he/she needs to do. One can also do the same with an input file.