Postgres dump to CSV

Here is a simple command to dump your Postgres DB to a CSV file.

echo "SELECT * FROM MyTable;" | psql --tuples-only --field-separator ',' --no-align --host 192.168.1.5 database username

Note: this will break if your data has commas in it.



Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 18.188.20.56
To prevent spam please submit by clicking the kitten: