Wednesday, March 23, 2011

How to export to CSV in PostgreSQL with psql in cmd

psql -U postgres -c "COPY (select 'a', ',b') TO STDOUT WITH CSV HEADER" database