How to export data from PostgreSQL table to CSV file