title: How do you print the result of a PostgreSQL query in CSV or TSV format from the command line?
body: <p>I'd like to execute a query from the shell (not in the interactive psql client) and have it print the CSV or TSV representation of the output to STDOUT. How do you do that with <code>psql</code> or one of the PostgreSQL command-line tools?</p>