To save the result of a query in CSV format from PSQL:
\copy (select * from toto) to '/tmp/toto.csv' with CSV