Last Updated: February 25, 2016
·
529
· paullainchbury

Export a database table from Postgres in CSV format

Access the postgres dB:

psql [user] -d [database-name]

To create the .csv file:

\copy [table name] TO name_your_file.csv CSV DELIMITER ',' HEADER

The .csv will be located in your current working directory.