Store result of a PostgreSQL query as a CSV file

Executes a query against a Postgres database and writes the output to a new file

Authored by: sorin
query
file_name

Command
Copy
psql -d dbname -t -A -F"," -c "query" > file_name
Tags